RosettaCodeData/Task/Map-range/J/map-range-2.j

7 lines
120 B
Text
Raw Permalink Normal View History

2013-04-10 21:29:02 -07:00
maprange=:2 :0
'a1 a2'=.m
'b1 b2'=.n
b1 + ((b2-b1)%a2-a1) * -&a1
)
NB. this version precomputes the scaling ratio