[racket-dev] Racket docs and data-driven design
In addition to what Jay said, when the datatype evolves, it's harder
for someone reading the code to tell whether the "else" was meant to
cover only one other case (and now there's two, and someone forgot to
update the function) or truly all the other cases.
When you have crisp predicates, I see no excuse for using else -- it's
intellectually sloppy and causes both missed early-errors (as Jay
shows) and later pain. For really complex predicates, it makes sense:
(cond
[(prime (foo (bar x))) ...]
[else ...])
offers many advantages over
(cond
[(prime (foo (bar x))) ...]
[(not (prime (foo (bar x)))) ...])
Shriram