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

7 lines
120 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
maprange=:2 :0
'a1 a2'=.m
'b1 b2'=.n
b1 + ((b2-b1)%a2-a1) * -&a1
)
NB. this version precomputes the scaling ratio