Hi Edwin,

> On Thu, Jul 28, 2011 at 4:48 AM, Tomas Hlavaty <t...@logand.com> wrote:
> > Hi Edwin,
> >
> >> thinking about it a bit, i can just do away with one and live with the
> >> other?  say, can i just live with (bind)?
> >
> > yes, but it is more convenient to write let in your programs instead of
> > the bind with constructing the binding list manually.  However, in
> > certain situations, one needs an evaluating version, e.g. when you
> > construct code programmatically.  I hit this situation in the wl
> 
> reading the docs again after this, (let) evaluates while (bind) does
> not. i hope i got that right.

Yes.

BTW, in the reference evaluated arguments are marked with a quote

   (let sym 'any . prg) -> any
   (let (sym 'any ..) . prg) -> any

   (bind 'sym|lst . prg) -> any

so we see that 'let' doesn't evaluate 'sym', while 'bind' does.


As Tomas said, it is a matter of convenience:

   (let A (lines "lib.l")
      (* A A) )


If you wanted to use 'bind' for that, you could do

   (bind 'A
      (setq A (lines "lib.l"))
      (* A A) )

or

   (bind (list (cons 'A (lines "lib.l")))
      (* A A) )


'bind' is more flexible, as the symbols can be determined at runtime,
while 'let' allows for a more readble code.

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to