That makes sense now. Thanks for the clarification!

Kevin

On Tue, Feb 8, 2022 at 1:03 PM Alexander Burger <a...@software-lab.de> wrote:

> Hi Kevin,
>
> > I may have encountered a possible bug, unless my understanding of @ is
> > incorrect. It appears the value of @ is not restored in a prog1 body when
> > another flow/logic statement occurs as the car of an expression within
> the
>
> This is right. All flow functions which set '@' do *not* bind it. The
> value is
> simply set.
>
>
> > Test Cases:
> >
> >   (let (A0 (1)
> >         A1 (2 3)
> >         A2 'x)
> >     (prog1 (cdr A1)
>
> At this moment '@' is set to the result of evaluating (cdr A1).
>
> >       ((if (sym? A2) 'set 'con) A2 A0)
>
> Now '@' was overwritten by 'if'.
>
>
> '@' is bound only on the function call level. That is, '@' is restored to
> the
> caller's value when the function returns.
>
> But inside a function's body the rule is that
>
> 1. Functions with controlling expressions just set '@' to the result.
> 'prog1' is
>    such a function.
>
> 2. Functions with conditional expressions set '@' to the result *IF* the
> result
>    is non-NIL (otherwise they leave it untouched).
>
>
> All this is described in more detail in
>
>    https://software-lab.de/doc/ref.html#atres
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>

Reply via email to