# [plt-scheme] to define, or to let

======= 2004-03-19 08:05:22 ：=======
>*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
*>*
*= = = = = = = = = = = = = = = = = = = =
IMO,
(define a-function
(lambda ()
(define one-variable 3)
(define another-variable 4)
(list one-variable another-variable)))
is just the same as
(define a-function
(lambda ()
(letrec ((one-variable 3)
(another-variable 4))
(list one-variable another-variable))))
And these two will generate same code.
regards,
Zhu Chongkai