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.
--
Paul Hobbs


On Sat, May 29, 2010 at 1:32 AM, Eugen Dück <eu...@dueck.org> wrote:

> 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 need the apply to cause that exception, but calling
> interleave directly with just one parameter doesn't make any sense.
> But in the case you use apply, having only one sequence in a sequence
> is a possible corner case that can arise "at run time")
>
> In order to make interleave more general, I'd like to add a "one param
> overload" to interleave like
>
> (defn interleave
>  "Returns a lazy seq of the first item in each coll, then the second
> etc."
>  ([c] (seq c))
>  ...
>
> or even just
>
> (defn interleave
>  ([c] c)
>
> but that would break the contract of interleave, in that it returns
> whatever you pass in, which might not be a sequence, as is the case in
> my example.
>
> Any thoughts on this?
>
> Eugen
>
> --
> 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<clojure%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

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