Hi Kashyap,

> kashyap@CPC-ckk-S75640M:~$ cat a.l
> (de add (N D)
>    (put 'STORE N D) )
> (add "A" 10)
> (add "B" 20)
> (prinl (get 'STORE "A"))
> (prinl (get 'STORE "B"))
> kashyap@CPC-ckk-S75640M:~$ pil a.l
> 10
> 20
> : (get 'STORE "A")
> -> NIL
> : version
> -> 274406
> 
> Shouldn't I get 10 as a result of (get 'STORE "A") from the REPL?

No, because transient symbols like "A" and "B" have a file-local scope (just
like symbols in the 'private' namespace).

Property functions like 'put' and 'get' access the value by the symbol itself
(using pointer equality, '=='), not by the name. So the "A" in

   (get 'STORE "A")

in the REPL *after* the file is loaded is another symbol than the "A" in the
file *while* it is loaded.

☺/ A!ex

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

Reply via email to