Alexander Burger <a...@software-lab.de> writes:

Hi Alex,

>> I wonder how I can use local variable X inside of the 'glue'
>> argument list:
>> 
>> ,----
>> | : (let X (+ 3 4) X)
>> | -> 7
>> | 
>> | : (let X (+ 3 4) (glue " " '("Number"  X `(- 4 9))))
>> | -> "Number X -5"
>> | 
>> | : (let X (+ 3 4) (glue " " '("Number"  `X `(- 4 9))))
>> | -> "Number  -5"
>> `----
>> 
>> X does not seem defined in the last expression although its surrounded
>> by (let X (+ 3 4) ...). 
>
> Hmm, read-macros seem indeed a lot misunderstood. NEVER use a read-macro
> to insert values which are defined at *run*time! As the name says, they
> are evaulated at *read* time!
>
>
> You could do this:
>
>    : (let X (+ 3 4) (glue " " (list "Number"  X `(- 4 9))))
>
> (the second read-macro is OK, as the (- 4 9) may be evaluated at
> read-time)

Ah, I see, thanks.  

I think the (working) second read-macro fooled me a bit, and I did not
have separation of read- and runtime very clear. Well, nice that, as
always with PicoLisp, there is an easy way to make it work ;-)

-- 
cheers,
Thorsten

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

Reply via email to