Don Green
2015-02-19 17:40:45 UTC
What is/are the reason(s) for choosing the 'let*' construct over the
'define' construct?
(define (print-two f)
(let* ([_ (print (first f))]
[f (rest f)]
[_ (print (first f))]
[f (rest f)])
f))
(define print-two
(lambda (f)
(print (first f))
(set! f (rest f))
(print (first f))
(set! f (rest f))
f))
(void (print-two '(1 2))) ;=> 12
'define' construct?
(define (print-two f)
(let* ([_ (print (first f))]
[f (rest f)]
[_ (print (first f))]
[f (rest f)])
f))
(define print-two
(lambda (f)
(print (first f))
(set! f (rest f))
(print (first f))
(set! f (rest f))
f))
(void (print-two '(1 2))) ;=> 12