[racket-dev] Racket docs and data-driven design

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Fri Sep 16 14:31:25 EDT 2011

I admit sloppiness. 


On Sep 16, 2011, at 12:49 PM, Shriram Krishnamurthi wrote:

> 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
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/dev



Posted on the dev mailing list.