I seem to recall seeing a ticket opened in JIRA for this recently with
a patch so maybe it'll get incorporated.

On Wed, Nov 2, 2011 at 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):
>
> (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?

-- 
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

Reply via email to