Evaluating symbols in nested lists

Started by Tim Johnson, December 23, 2007, 05:13:36 PM

Previous topic - Next topic

Tim Johnson

I have the following symbols and values:

> key

"test"

> res

(("test" "one"))

> val

"one"

> newval

"two"

;; And I want to change 'res to (("test" ("one" "two"))

;; but:
(replace-assoc key res '(key (list val newval)))

;; gives me

(key (list val newval))

I understand that the symbols in '(key (list val newval))

aren't being evaluated, but don't

know which function to use to evaluate them.

Thanks

Tim
Programmer since 1987. Unix environment.

Tim Johnson

#1
Never mind:

I was looking for this:
(replace-assoc key res (expand '(key (val newval))
                                           'key 'val 'newval))

Doesn't common lisp use the comma operator to do the

same thing?

thanks

Tim
Programmer since 1987. Unix environment.

Lutz

#2
just do:


(replace-assoc key res (list key (list val newval)))

=> (("test" ("one" "two")))


Lutz

Tim Johnson

#3
Understood.

Thanks, Lutz
Programmer since 1987. Unix environment.