[racket] Why choose the 'let*' construct over the 'define' construct when both can have sequential scope?

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Thu Feb 19 12:49:16 EST 2015

In some places, you are allowed only one expression, and for that situation, you need let*. 


On Feb 19, 2015, at 12:40 PM, Don Green <infodeveloperdon at gmail.com> wrote:

> 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
> 
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users



Posted on the users mailing list.