Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
21
Task/Map-range/M2000-Interpreter/map-range-1.m2000
Normal file
21
Task/Map-range/M2000-Interpreter/map-range-1.m2000
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
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
|
||||
12
Task/Map-range/M2000-Interpreter/map-range-2.m2000
Normal file
12
Task/Map-range/M2000-Interpreter/map-range-2.m2000
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
module MapRange {
|
||||
Map=lambda (a,a2,b,b2) -> {
|
||||
if a2-a=0 then error "wrong parameters"
|
||||
f=(b2-b)/(a2-a)
|
||||
=lambda a,b,f (x)->b+(x-a)*f
|
||||
}
|
||||
m1=Map(0,10, -1, 0)
|
||||
for i=0 to 10
|
||||
Print i," maps to ";m1(i)
|
||||
next
|
||||
}
|
||||
MapRange
|
||||
Loading…
Add table
Add a link
Reference in a new issue