> For one thing, the quote in the call of 'up' is too much. But this
> is not the main problem.

Sorry, my mistake.

> The hard-to-explain thing is, that here (up @ 2) is needed:
>
>    (de foo "Prg"
>       (when (car "Prg")
>          (run (let @ (up @ 2) (cdr "Prg"))) ) )

(up @ 2) is not right, it sets @ to 2 which makes the example
(and 2 (foo T (+ 1 @ 3))) pass.   If you try (and 4 (foo T (+ 1 @ 3)))
it will not return the right value.  That's detail anyway, I'm with you now.

> Basically you were right to access '@' one level up.
>
> But the implementation of 'up', 'eval' and 'run' is such that it looks
> for binding frames that have '@' bound as their first symbol. The reason
> is that we want to skip intermediate frames (with 'let', 'use', 'for'
> etc.). Usually, only the binding frame for functional arguments start
> with '@'. But you managed to create such a frame!
>
> You can verify this by testing
>
>    (de foo "Prg"
>       (when (car "Prg")
>          (let (@ (up @)  Dummy 7)
>             (run (cdr "Prg"))) ) )
>
> Now '@' is not the first bound symbol in the frame (when seen from the
> lower parts of the stack), but 'Dummy'. So (up @) works.

Uff, I see the trick.

There seems to be difference between (let @ (up @) ...) and
(let (@ (up @)) ...):

(de foo "Prg"
   (when (car "Prg")
      (let @ (up @)
         (run (cdr "Prg"))) ) )

: (and 4 (foo T (+ 1 @ 3)))
!? (+ 1 @ 3)
T -- Number expected
? 

(de foo "Prg"
   (when (car "Prg")
      (let (@ (up @))
         (run (cdr "Prg"))) ) )

: (and 4 (foo T (+ 1 @ 3)))
-> 8

..so I do not need Dummy.

Thanks for explanation.

Tomas
-- 
UNSUBSCRIBE: mailto:[EMAIL PROTECTED]

Reply via email to