And we could actually also add an no-arg version. My own version of
interleave that I use looks like this:
(defn interleav
([] nil)
([c] (seq c))
([c1 c2] (interleave c1 c2))
([c1 c2 & colls] (apply interleave c1 c2 colls)))
I guess that's as generic as it gets.
Does Rich read all thread
On May 31, 10:07 pm, Daniel Werner
wrote:
> quantitative logic
That should have been "quantification logic".
--
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 membe
On May 30, 12:51 am, Eugen Dück wrote:
> How often do you do:
> (+ 5)
> or
> (* 3)
>
> ? But you might have used something like
> (apply + coll)
> or
> (reduce + coll)
>
> and under certain circumstances your coll might have had only one
> element.
This is a good line of reasoning. Let's add an e
If not, I don't see a reason to include it.
> > --
> > Paul Hobbs
> >
> > On Sat, May 29, 2010 at 1:32 AM, Eugen Dück wrote:
> > > When I do
> >
> > > (apply interleave some-colls)
> >
> > > and some-colls is a sequence/collection o
; special case? If not, I don't see a reason to include it.
> --
> Paul Hobbs
>
> On Sat, May 29, 2010 at 1:32 AM, Eugen Dück wrote:
> > When I do
>
> > (apply interleave some-colls)
>
> > and some-colls is a sequence/collection of only one sequ
On May 29, 2010, at 5:07 AM, Paul Hobbs wrote:
> What code would this make simpler? Are you constantly having to check this
> special case? If not, I don't see a reason to include it.
I haven't run across this particular issue, but I have many times written code
that may end up calling a func
quence/collection of only one sequence/
> collection, it will throw:
>
> user=> (apply interleave [[1 2]])
> java.lang.IllegalArgumentException: Wrong number of args passed to:
> core$interleave (NO_SOURCE_FILE:0)
>
> (Of course I don't need the apply to cause that excep
When I do
(apply interleave some-colls)
and some-colls is a sequence/collection of only one sequence/
collection, it will throw:
user=> (apply interleave [[1 2]])
java.lang.IllegalArgumentException: Wrong number of args passed to:
core$interleave (NO_SOURCE_FILE:0)
(Of course I don't