Thanks. Do you think the call to z/edit in my code could be simplified? To edit a branch node I have to use conj to build a node only to pass it to make-node which will break it apart again.
On Wednesday, November 27, 2013 5:53:31 AM UTC, Carlo wrote: > > Okay, now after actually reading the documentation I can come back with > an actually correct response! > > You should only have to change one function: > > > (defn make-node [n children] > > (vec (cons (first n) children))) > > Your issue was that your original `make-node` function didn't return a > vector, it returned a ConsCell (with a vector as its tail). This meant > that your new node no longer returned true for "children", that is it > identified itself as a leaf. > > By making `make-node` return a vector (vec turns any sequable thing into > a vector) your `make-node` now returns a valid branch node, so z/next > behaves as you want it to. > > Carlo > -- -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.