[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Always using let*

From: Drew Adams
Subject: RE: Always using let*
Date: Sun, 14 Sep 2014 14:25:30 -0700 (PDT)

> Would it be OK to always use let*? I was just bitten by the fact
> that with let you can not previous variables from the let statement,
> as is possible with setq. So I am thinking about always using let*,
> so I do not have to think about it. Or are there good reasons to use
> let when you do not need let*?

The most common reason is when you want to use a variable value
in the cadr of a binding and you do *not* want to pick up the
variable's newly bound value.  IOW, precisely the opposite use
case of what you wanted when you were bit.

(setq c 3)

(let ((c  (+ c 4))
      (b  (* c 42))) ; Use original C value: 3

(The other reason is that for some Lisps the bindings of `let'
can be done in parallel, which can be quicker.)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]