I want to grow a tree programmatically so have been trying zippers:
(defn insert-parent [loc n]
(clojure.zip/replace loc (clojure.zip/make-node
loc n loc)))
(println (clojure.zip/root (insert-parent (clojure.zip/seq-zip (list
1)) 2)))
(println (clojure.zip/root (clojure.zip/append-child
(clojure.zip/seq-zip (list 1)) 2)))
[(1) nil]
(1 2)
My 'insert-parent' function does not work, I was trying to get (2 1) -
any tips?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---