Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
meindnoch
11 months ago
|
parent
|
context
|
favorite
| on:
The bloat of edge-case first libraries
clamp should actually accept anything comparable. E.g. clamp("foo", "bar", "baz") should return "baz".
Minor49er
11 months ago
[–]
Why wouldn't it return "foo" instead?
meindnoch
11 months ago
|
parent
[–]
Because "bar" < "baz" < "foo". The function signature is: clamp(value, min, max)
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: