where is the value which is assigned by setq to a symbol?

Started by lyl, July 22, 2020, 11:49:18 PM

Previous topic - Next topic

lyl

I wonder where or how I can get the value which is assign by setq to a symbol like this:
(setq 'f 100)
'f ;;-> f
''f ;;->'f

How can I get the value 100?

cameyo

Maybe you can define 'f in a different way:
(set (sym {'f}) 100)
;-> 100
(eval (sym {'f}))
;-> 100

or
(set (sym {''f}) 2)
;-> 2
(eval (sym {''f}))
;-> 2
cameyo

fdb

Wel you either do

> (set 'f 100)
100
> f
100

Or you do
> (setq f 100)
100
> f
100

With set you have to quote because set evaluates its arguments, setq doesn't.

lyl

Many thanks! But where is the value stored in the expression "(setq 'f 100)"

TedWalther

Whereever it is stored, if anywhere, it is immediately deleted on returning from setq.  Why?  Because 'f is the same as (quote f)  And setting a value to a quote cell doesn't bind it to a symbol... so the ORO memory manager (should) just toss it.
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence.  Nine months later, they left with a baby named newLISP.  The women of the ivory towers wept and wailed.  \"Abomination!\" they cried.