[plt-scheme] to define, or to let

From: Richard Cleis (rcleis at mac.com)
Date: Fri Mar 19 00:31:01 EST 2004

Thanks.  That is why I try to use let-lists instead of 
define-statements.  A compiler might also try to optimize 
define-statements, but it seems that, in scheme, define-statements mean 
something very specific.  That is what I am trying to figure out.

BTW, using (time) and looping over the two functions shows that the let 
form is about 10 percent faster than the define-form.  Ie, it looks 
like the compiler *is* smart.

rac


On Mar 18, 2004, at 9:58 PM, Zhu Chongkai wrote:
> 			
> Yes, a smart compiler will treat let without creating storage.
>
> For example:
>
> (let ((one-variable 3)
>       (another-variable 4))
>   (list one-variable another-variable))
>
> will first be converted to
>
> ((lambda (one-variable another-variable)
>    (list one-variable another-variable))
>  3 4)
>
> and then the code will be further optimized to
>
> (list 3 4)
>
>
> regards,
> Zhu Chongkai



Posted on the users mailing list.