On Sep 16, 2011, at 11:52 AM, Shriram Krishnamurthi wrote:
I introduced templates today. Almost as if on cue, one student asked
whether he could use else instead of (cons? l). I told them I was
going to make a MORAL judgment about why it was EVIL, and spent ten
minutes talking about all that
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
>
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 n
I don't like it either because it makes the function a contract violator:
(define (listy l)
(cond
[(empty? l)
...]
[else
... (first l) ...]))
(define (f x)
... (listy 5) ...)
f breaks listy's contract, but it goes undetected in most of Racket
and all of HtDP and listy gets blamed for
Why is else evil? I can see how it might be pragmatic to avoid it in a
language without contracts, but I'm having trouble seeing evil.
Robby
On Fri, Sep 16, 2011 at 10:52 AM, Shriram Krishnamurthi
wrote:
> I introduced templates today. Almost as if on cue, one student asked
> whether he could
The same is true of HtDP:
http://htdp.org/2003-09-26/Book/curriculum-Z-H-13.html#node_chap_9 and
HtDP 2e: http://www.ccs.neu.edu/home/matthias/HtDP2e/htdp2e-part2.html
. (search for "[else" in a similar way).
On Fri, Sep 16, 2011 at 11:52 AM, Shriram Krishnamurthi
wrote:
> I introduced templates
I introduced templates today. Almost as if on cue, one student asked
whether he could use else instead of (cons? l). I told them I was
going to make a MORAL judgment about why it was EVIL, and spent ten
minutes talking about all that.
As class ended, one of my students came up and said,
"So wh
7 matches
Mail list logo