RosettaCodeData/Task/Map-range/J/map-range-2.j
2023-07-01 13:44:08 -04: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