[racket] Style mistakes (was: static variables question)

From: John Clements (clements at brinckerhoff.org)
Date: Tue Feb 21 12:45:31 EST 2012

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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120221/074af979/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4624 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20120221/074af979/attachment.p7s>

Posted on the users mailing list.