Thoughts
All languages should have a `constrain` function somewhere in their standard library.
It's simple enough that I should be able to use it in one line, but `min(max_val, max(min_val, val))` is ugly and unreadable.