2010/12/29 Ken Wesson <kwess...@gmail.com> > On Wed, Dec 29, 2010 at 11:42 AM, Laurent PETIT <laurent.pe...@gmail.com> > wrote: > > 2010/12/29 Ken Wesson <kwess...@gmail.com> > >> (defn insert-into [s x] > >> (let [[low high] (split-with #(< % x) s)] > >> (concat low [x] high))) > >> > >> (defn insertion-sort [s] > >> (reduce insert-into [] s)) > > > > Hello, just a little 0.00002€ : insert-into will return seqs, so the > reduce > > could read : > > (reduce insert-into () s) > > to make it clear that it's seqs end to end inside insertion-sort > > It's my habit to use a vector for any "seq literal". > > How about I split the difference? > > (reduce insert-into nil s) > > seems to work just as well. :) >
Yeah, not a big deal, it's just that by just reading the line (reduce insert-into [] s), I see the initial "collected value" is a vector, and I make an assumption about insert-into to return vectors as well. -- 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