[racket] Why internal definitions?

From: Mark Engelberg (mark.engelberg at gmail.com)
Date: Wed Nov 16 14:22:32 EST 2011

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) ...])]))


Posted on the users mailing list.