On Wed, Sep 14, 2011 at 3:58 PM, octopusgrabbus <octopusgrab...@gmail.com> wrote: > Alan: > > I may have misunderstood what I've read both in books, blogs, and the > Clojure site, but it seems that writing recursive functions in the loop .. > recur style is the preferred style. I also remember most of the texts > currently out on Clojure say use the higher level sequence functions rather > than recursion. I get it. > > I wanted to do this particular exercise without the aid of Clojure.zip.
I would highly recommend using zip for such things, because otherwise you have to write code like this: (defn skl [tree] (loop [[self & todo :as src] [tree], dst [()]] (cond (empty? src) dst (not (coll? self)) (recur todo (first dst)) (empty? self) (recur todo (conj (first dst) (rest dst))) :else (recur (list* (first self) (rest self) todo) [dst])))) Jonathan Claggett helped write that. I'm not sure there was ever a moment where we both understood it simultaneously. It essentially does what zippers do, but holds the data in a loop/recur frame rather than a data structure. Any further explanation is left as an exercise to the reader. --Chouser -- 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