[plt-scheme] to define, or to let

From: Robby Findler (robby at cs.uchicago.edu)
Date: Thu Mar 18 19:25:11 EST 2004

They do not generate the same code, but they are observably equivalent
to each other modulo names (and to (define (a-function) (list 3 4)) for
that matter).

The first is useful for recursive definitions (as is letrec) the second
isn't. It's not really a big deal, either way, imo.

Robby

At Thu, 18 Mar 2004 17:05:22 -0700, Richard Cleis wrote:
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> 
> 1) Do these two generate the same code?
> 2) Which one best contains the spirit of scheme?
> 
> (define a-function-using-defines
>    (lambda ()
>      (define one-variable 3)
>      (define another-variable 4)
>      (list 3 4))) ; just checking
> 
> (define a-function-using-let-list
>    (lambda ()
>      (let ((one-variable 3)
>            (another-variable 4) )
>        (list 3 4)))) ; just checking
> 
> rac


Posted on the users mailing list.