Re: How can we replace an element in a deeply nested list?

2010-05-14 Thread Lee Spector
Ooo -- postwalk-replace, which I didn't know about, is much better than what I was going to suggest! But since this still might be of some interest to the OP here is the message I had composed before ajuc's message came through: --- Setq doesn't do that in Lisp, but subst does. I've defined su

Re: How can we replace an element in a deeply nested list?

2010-05-14 Thread ajuc
Setq isn't functional - equivalent in clojure would be def, but it isn't meant to be used in that way. For your purpose there is better fit: postwalk-replace http://richhickey.github.com/clojure/clojure.walk-api.html#clojure.walk/postwalk-replace Greetings. -- You received this message because

How can we replace an element in a deeply nested list?

2010-05-14 Thread krsnewwave
Hi all, I'm new to this language and is working on a few problems on my own. I have this deep list, (of arbitrary depth, because I am trying to work out a genetic program..) and I want to change, say, all x's in this list. Replace doesn't work. Do I really have to define a recursive function to "