P.S. The transpose fn is one of the cases where I'd like to have a
more general interleave fn, as lobbied for here:
http://groups.google.com/group/clojure/t/c0366933a4333b69

Because with the current version of interleave:

user=> (transpose [[1 2]])
java.lang.IllegalArgumentException: Wrong number of args passed to:
core$interleave (NO_SOURCE_FILE:0)

On Jun 6, 9:51 pm, Eugen Dück <eu...@dueck.org> wrote:
> Suppose I have two collections:
>
> (def x [1 2])
> (def y [[\a \b] [\d \e] [\f \g]])
>
> And want to iterate over them in the following manner:
>
> user=> (map list x (transpose y))
> ((1 (\a \d \f))
> (2 (\b \e \g)))
>
> Where this is the transpose fn:
>
> (defn transpose
>   [in]
>   (partition (count in) (apply interleave in)))
>
> Is there any other nice way to do this without relying on some home-
> grown fn?
>
> Cheers
> 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
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to