blob: fbf0feaeb2f4887b53feddd249ed2be2f55b9560 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
Misc. thoughts on the standard library
======================================
Naming/usability
----------------
Min/max is easy to get wrong. Min is used to cap to a maximum, while max is
used to cap to a minimum! Perhaps use a combined function, or some other
names?
# but the parameter ordering can be mixed up :(
v <- bound 0 v 99
v <- bound v 0 99
v <- bound 0 99 v
# alternative names to min/max
# ordering technically doesn't matter,
# but there should be a convention
v <- at_least v 0
v <- at_least 0 v
v <- at_most v 99
v <- at_most 99 v
|