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

6 lines
123 B
Factor
Raw Permalink Normal View History

2013-04-10 21:29:02 -07:00
USING: locals infix ;
:: map-range ( a1 a2 b1 b2 x -- y )
[infix
b1 + (x - a1) * (b2 - b1) / (a2 - a1)
infix] ;