http://groups.google.com/group/clojure-dev/browse_thread/thread/b81c6c8621629960/b73ed6ba28b60781
http://www.google.com/url?sa=D&q=http://dev.clojure.org/jira/browse/CLJ-863&usg=AFQjCNGcl4S8hvppsmfP8mtjo1W2y5wgfA On Nov 2, 6:28 pm, Alex Baranosky <alexander.barano...@gmail.com> wrote: > Something interesting I've noticed: > > I've recently realized I could simplify some application code of mine by > using interleave. I immediately noticed that in the spot I was using it I > would never be sure to have 2+ streams (from > here<https://github.com/AlexBaranosky/EmailClojMatic/blob/master/src/remin...> > ): > > (defmethod parse-reminder-dates :day-of-month [s] > (let [[ordinals-part] (re-captures day-of-month-identifier-regex s) > ordinals (map ordinal-to-int (re-match-seq ordinal-regex > ordinals-part))] > (apply interleave++ (map day-of-month-stream ordinals)))) > > For my purposes, in an application that might generate 0+ streams, it made > sense to create a variation of interleave, I dub interleave++: > > (defn interleave++ [& colls] > "like interleave from core, but does something sensible with 0 or 1 > collection" > (cond (empty? colls) > [] > > (= 1 (count colls)) > (first colls) > > :else > (apply interleave colls))) > > Is there a strategic reason interleave wasn't made to be a bit more > flexible, so as to be able to ignore checking for edge cases in the code > that uses interleave? > > Best, > Alex -- 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