RosettaCodeData/Task/Map-range/J/map-range-2.j
Ingy döt Net db842d013d A-M baby
2013-04-10 21:29:02 -07:00

6 lines
120 B
Text

maprange=:2 :0
'a1 a2'=.m
'b1 b2'=.n
b1 + ((b2-b1)%a2-a1) * -&a1
)
NB. this version precomputes the scaling ratio