Re:Math.min(Math.max(num, min), max)
by gre on Thursday August 20, 2020 @12:57PM
(#24225448)
In Factor:
https://docs.factorcode.org/content/word-clamp,math.order.ht...
[ Parent
| on HN ]
For casual readers,
`dip` pops the top of the stack, executes a quotation, then pushes the top of the stack back on.
So this pops the max value off the stack, applies the quoted `max` word to the x and min stack values, then pops the max value back on the stack and applies the `min` word to the result and the max.