RosettaCodeData/Task/Map-range/Factor/map-range-2.factor

6 lines
123 B
Factor
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
USING: locals infix ;
:: map-range ( a1 a2 b1 b2 x -- y )
[infix
b1 + (x - a1) * (b2 - b1) / (a2 - a1)
infix] ;