[plt-scheme] to define, or to let
I messed up the question; the final expressions should be:
(list one-variable another-variable)
So what is the difference in the generated code? Are let-variables
created differently than define's ? It seems that a smart compiler
wouldn't create storage at all in the let version (ie, it would just
form the list).
rac
On Mar 18, 2004, at 5:25 PM, Robby Findler wrote:
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
> 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