Meikel Brandmeyer <m...@kotka.de> writes: > A transcript: > > ; Create trees... > user=> (def t1 [1 [[2 3] 4]]) > #'user/t1 > user=> (def t2 [[[:a :b] :c] :d]) > #'user/t2 > > ; Create zippers and navigate to subtrees... > user=> (def zt1 (-> (zip/vector-zip t1) zip/down zip/right)) > #'user/zt1 > user=> (zip/node zt1) > [[2 3] 4] > user=> (def zt2 (-> (zip/vector-zip t2) zip/down)) > #'user/zt2 > user=> (zip/node zt2) > [[:a :b] :c] > > ; Replace the subtree from first zipper with subtree from second > zipper... > user=> (def zt1 (zip/replace zt1 (zip/node zt2))) > #'user/zt1 > user=> (zip/root zt1) > [1 [[:a :b] :c]] > > Isn't that what you want?
It isn't what I want. But that's because I misspecified what I actually wanted. I didn't think about the problem enough. I need something more akin to a splice function: (splice tree1 index tree2) (splice '(1 2 (3 4 5) 6) 4 '(7 8 (9 10))) should produce => '(1 2 (3 7 8 (9 10) 6)) think crossover in genetic programming (this is actually what I need this for). --J. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---