3 ms·
True. But consider the form: (if (someExpr) (doTrueStuff) ) Then a duplication of the `doTrueStuff` line would lead to true stuff being done reg
by yohanatan 12y ago
True. But consider the form:
(if (someExpr)
(doTrueStuff)
)
Then a duplication of the `doTrueStuff` line would lead to true stuff being done regardless of the truthiness of someExpr (as the third [optional] argument to `if` is the else branch).
This form is not entirely unheard of either. The overtone library for example assigns labels to its event handlers like such:
(defn eventHandler ( ...
stuff
) :: event_handler_label)
- Jtsummers 12y agoThis is actually why I really like `cond` in Common Lisp (and other lisps and languages). You have to make explicit what should happen if your desired expression is true, and the only way to have an `else` clause is `(t ...)` so you have to intentionally create that last wildcard spot.