Basic evaluation confusion again, this time with replace
Posted: Thu Jan 25, 2007 6:05 pm
I don't quite understand why this happens. Basically, it's whether a symbol that contains a string evaluates to a string or not when used in replace:
You see, I thought that (first f) would give replace either "string1" or s, which is a string (and which is OK). But no.
I get confused like this occasionally... ;-)
Code: Select all
(set 's "string")
(println
(replace s "this is a string" "rope") ; symbol OK
)
;-> this is a rope
(set 'l '(
("string1" 1)
(s 2)))
(println
(map (fn (f) (replace (first f) "this is a string" "rope")) l) ; symbol not OK
)
string expected
I get confused like this occasionally... ;-)