News for hackers. Stuff that matters.
Re:Math.min(Math.max(num, min), max) by forth_fool on Friday August 21, 2020 @01:06AM (#24232158)
Talking about obscurity of code, in Forth you would write:

  5 9 7 min max .
This prints 7, as it's between 5 (lower bound) and 9 (upper bound).

Defining a clamp "function" looks like this:

  : clamp ( min max n -- clamped_n )
    min max ;

There are no comments on this comment yet.