[racket] syntax, differently

From: Marco Morazan (morazanm at gmail.com)
Date: Mon Aug 2 09:02:50 EDT 2010

On Mon, Aug 2, 2010 at 7:21 AM, Horace Dynamite
<horace.dynamite at gmail.com> wrote:
> On Sat, Jul 31, 2010 at 4:00 PM, Matthias Felleisen
> <matthias at ccs.neu.edu> wrote:
>
>> 1. Could drracket limit the width of programs in the teaching language world to 80 columns?
>
> As another student, this "feature" would really annoy me.  Having read
> Matthias' style guidelines on his assignments webpage for HtDP, I was
> perfectly aware that I should try my best to keep my lines less than
> 80 characters, and not to march my parens back over to the left after
> a definition, etc. (This actually just matched my natural aesthetics
> requirements anyway...).
>
> There were some exercises in HtDP (Queens,Cannibals, IIRC), that I
> just found I had to exceed to 80 characters for it read nicely to me.
> For instance, when you start getting into patterns like
>
> (define (...)
>   (cond (p1 e1)
>             ....
>            (else (local [(define (...)
>                                   (cond (p2 e2)
>                                              ...
>                                              (else (local [.... etc.
>
> augmented with descriptive names, I can tell you that 80 characters
> quickly gets chewed up.
>

Perhaps, you should consider making separate functions for each nested
cond and nested local. There is nothing "easy to read" about code with
the shape above. One cond and one local per function is a good rule of
thumb.

-- 

Cheers,

Marco


Posted on the users mailing list.