> Hi Doug,
>
> This clamp functionality is already present in math.ranges as clamp- 
> to-range:
>
> ( scratchpad ) 100 -20 0 [a,b] clamp-to-range .
> 0
> ( scratchpad ) 100 20 0 [a,b] clamp-to-range .
> 20
> ( scratchpad ) 100 120 0 [a,b] clamp-to-range .
> 100

clamp-range doesn't work with float or rational intervals, since  
ranges model sequences of discrete, evenly-spaced values rather than  
continuous intervals:

( scratchpad ) 2.25 1.0 2.5 [a,b] clamp-to-range .
2.0 ! rather than the expected 2.25

Clamping doesn't make sense as a range operation, so I favor having it  
be an independent operation.

-Joe

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to