Alex,

My mistake! In playing with that code,  I had defined (setq L 99) shortly
before that and forgotten I had done so.
Without that, as you pointed out....

: (de myf (F L) (F L))
-> myf
: (let (L 99) (myf '((x) (+ (car x) `L)) (1 2)))
-> NIL

A good lesson in taking care with scope and current execution environment.

Thanks!
/Lindsay




On Tue, Feb 7, 2017 at 11:34 PM, Alexander Burger <a...@software-lab.de>
wrote:

> Hi Lindsay,
>
> > :(de myf (F L) (F L))
> > -> myf
> > : (let (L 99) (myf '((x) (+ (car x) `L)) (1 2)))
> > -> 100
>
> I do not think this works.
>
>
> > The key there is the back-quote (`) before the L to force evaluation
> > See the doc section on 'Read-Macros'
> > http://software-lab.de/doc/ref.html#macro-io
>
> Exactly. So the whole 'let' expression is read, *then* evaluated. 'L' is
> what it
> was globally at the time this expression was read, usually NIL.
>
>
> As Erik said, 'curry' is a way:
>
>    : (let (L 99) (myf (curry (L) (X) (+ (car X) L)) (1 2)))
>    -> 100
>
> ♪♫ Alex
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>

Reply via email to