[plt-scheme] why local? (just curious)

From: kumar_lista at mac.com (kumar_lista at mac.com)
Date: Thu Jan 15 20:45:49 EST 2009

> Ah!  The primary reason we used local for those examples was to avoid
> the use of lambda for the the internal function definitions.  We
> wanted to make the tutorial easy for newcomers to read.
>

Why not just permit (define ...) expressions anywhere with
mutually recursive bindings possible in the same scope,
so you don't have to use local in the first place?

Rewriting Sigrid's example -

(define (test n)
	(define start-value n)
	(define zero (- start-value start-value)
	(define (even? n) (if (= n zero) #t (odd? (- n 1))))
	(define (odd? n) (if (= n zero) #f (even? (- n 1))))
	(odd? n))

-Kumar


Posted on the users mailing list.