[racket] Why internal definitions?

From: John Clements (clements at brinckerhoff.org)
Date: Wed Nov 16 17:15:03 EST 2011

On Nov 16, 2011, at 11:22 AM, Mark Engelberg wrote:

> I frequently find myself wishing that you could use internal
> definitions in cond without introducing additional indentation, for
> example something like:
> 
> (define (fun-for-list l)
>  (cond
>    [(empty? l) ...]
>    (define fst (first l))
>    [(even? fst) ...]
>    [(odd? fst) ...]))
> 
> rather than
> 
> (define (fun-for-list l)
>  (cond
>    [(empty? l) ...]
>    [else
>       (define fst (first l))
>       (cond
>          [(even? fst) ...]
>          [(odd? fst) ...])]))

I sometimes wish that too... but looking at your mail, the second one is much easier to read and understand.

John Clements


-------------- 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/20111116/b995a343/attachment.p7s>

Posted on the users mailing list.