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

From: Shriram Krishnamurthi (sk at cs.brown.edu)
Date: Thu Jan 15 20:58:30 EST 2009

If you mean a different semantics for this than Scheme's internal
define, then you're going to create confusion.

If you mean the same semantics as Scheme's internal define, kindly
refer to the comp.lang.scheme thread I pointed you to.

Shriram

On Thu, Jan 15, 2009 at 8:45 PM,  <kumar_lista at mac.com> wrote:
>> 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
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>


Posted on the users mailing list.