Re: (apply interleave [[1 2]])

2010-06-06 Thread Eugen Dück
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

Re: (apply interleave [[1 2]])

2010-05-31 Thread Daniel Werner
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

Re: (apply interleave [[1 2]])

2010-05-31 Thread Daniel Werner
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

Re: (apply interleave [[1 2]])

2010-05-31 Thread Paul Hobbs
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

Re: (apply interleave [[1 2]])

2010-05-29 Thread Eugen Dück
; 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

Re: (apply interleave [[1 2]])

2010-05-29 Thread Michael Gardner
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

Re: (apply interleave [[1 2]])

2010-05-29 Thread Paul Hobbs
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

(apply interleave [[1 2]])

2010-05-28 Thread Eugen Dück
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