On Wed, Dec 29, 2010 at 9:31 PM, Mark Engelberg <mark.engelb...@gmail.com> wrote: > So here's the answer to the puzzle I posed earlier....
I just realized that the "append" function in my code was unnecessary, since into serves the same purpose. Thus my solution could be rewritten as: (defn insert [n alon] (loop [alon (seq alon), traversed nil] (cond (nil? alon) (into (list n) traversed) (<= n (first alon)) (into (cons n alon) traversed) (> n (first alon)) (recur (next alon) (conj traversed (first alon)))))) (defn isort [alon] (loop [alon (seq (reverse alon)), sorted nil] (if alon (recur (next alon) (insert (first alon) sorted)) sorted))) -- 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