On Feb 21, 2012, at 5:41 AM, Stephen Bloch wrote:

> On Feb 21, 2012, at 7:18 AM, Rodolfo Carvalho wrote:
> 
>> BTW I just found the nested-cond pattern appearing on HtDP, throughout 
>> section 9:
>> http://htdp.org/2003-09-26/Book/curriculum-Z-H-13.html
> 
> That happens when you follow the HtDP design recipe directly and there are 
> conditionals for two unrelated reasons, e.g. 
> 
> (cond [(empty? L) ...]
>            [(cons? L)
>                 (cond [(snark? (first L)) ...]
>                            [(boojum? (first L)) ...]
>                            [(beeblebrox? (first L)) ...]
>                 )])
> 
> Yes, this COULD be collapsed into
> (cond [(empty? L) ...]
>            [(snark? (first L)) ...]
>            [(boojum? (first L)) ...]
>            [(beeblebrox? (first L)) ...]
> )
> but that doesn't match the data structure as transparently.

+1.

I tell my students to ollapse the cond *only* when it makes more sense in the 
collapsed form---it rarely does.

John Clements


Attachment: smime.p7s
Description: S/MIME cryptographic signature

____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to