Map range: Difference between revisions

No edit summary
Line 2,186:
=={{header|M2000 Interpreter}}==
 
=== Using Class ===
<syntaxhighlight lang="m2000 interpreter">
module MapRange {
Line 2,209 ⟶ 2,210:
MapRange
</syntaxhighlight>
 
=== Using Lambda ===
 
<syntaxhighlight lang="m2000 interpreter">
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
</syntaxhighlight>
 
Same output for both versions
 
{{out}}
<pre>
Line 2,223 ⟶ 2,244:
10 maps to 0
</pre>
 
 
=={{header|Maple}}==
404

edits