Compose for NewLISP?
Posted: Sat Jan 28, 2012 6:30 am
Hi!
I realize that this is probably really easy and trivial... However! I would like to define an associative list that uses pre-existing variables. Something like this:
So that:
Of course this doesn't actually work because the "x" is quoted inside the quoted associative list, so it returns x the symbol instead of the value at associative list creation time. This will work, but it's ugly because you have to use different strategies to assemble the individual keys and values:
So... Is there any more elegant way to do it?
Thanks!
I realize that this is probably really easy and trivial... However! I would like to define an associative list that uses pre-existing variables. Something like this:
Code: Select all
(setq x 412)
(setq a '((name "Bob")
(age x)))
Code: Select all
(lookup 'age a) -> 412
Code: Select all
(setq a (list '(name "Bob")
(list 'age x)))
Thanks!