List building question

Gordon Price

Usenet Archive
Joined
Jul 14, 2003
Messages
203
Reaction score
0
I am trying to build a list of dotted pairs, where one value is actually pulled from a current sysvar value. I tried '(("cursorsize" . 100)("clayer" . (getvar "clayer"))) but rather than getting the value of the sysvar I get 'getvar "clayer"'. Am I out of luck here and I can't build a list this way?

Best,
Gordon
 
Gordon Price said:
I am trying to build a list of dotted pairs, where one value is actually pulled from a current sysvar value. I tried '(("cursorsize" . 100)("clayer" . (getvar "clayer"))) but rather than getting the value of the sysvar I get 'getvar "clayer"'. Am I out of luck here and I can't build a list this way?

Quoting a symbol or a list prevents it's evaluation. 'a is just a short form for (quote a), and this returns the symbol and not the value which is bound to it.

(list ... (cons "clayer" (getvar "clayer"))) does what you want.

BTW: the "q" in setq stands for "quote". You want the symbol to be set to a value, and not the value of the symbol be set to a value.

Try this

(setq test 'a)
(set test "here-I-am")
(print test)
(print a)

Tom Berger
 
Try this:
(list '("cursorsize" . 100)(cons "clayer" (getvar "clayer")))

Jeff
 
It's because you are quoting a list. If the list contains something to be evaluated, as yours does, you need something like

(list
'("cursorsize" . 100)
(cons "clayer" (getvar "clayer"))
)

You can quote the sublist that doesn't need evaluation, but need to cons the other.
 
Tom Smith said:
It's because you are quoting a list. If the list contains something to be evaluated, as yours does, you need something like

(list
'("cursorsize" . 100)
(cons "clayer" (getvar "clayer"))
)

10 minutes, three answers, and it's the Monday between Christmas and New Years! This place rocks! Thanks all.

Gordon
 

Latest threads

Back
Top