|
module MapRange {
|
|
class Map {
|
|
private:
|
|
a, b, f
|
|
public:
|
|
value (x){
|
|
=.b+(x-.a)*.f
|
|
}
|
|
class:
|
|
module Map (.a,a2,.b,b2) {
|
|
if a2-.a=0 then error "wrong parameters"
|
|
.f<=(b2-.b)/(a2-.a)
|
|
}
|
|
}
|
|
|
|
m1=Map(0,10, -1, 0)
|
|
for i=0 to 10
|
|
Print i," maps to ";m1(i)
|
|
next
|
|
}
|
|
MapRange
|