On Feb 4, 10:11 am, Ken Wesson wrote:
> This does it without using juxt:
>
> (defn supermap [fs & cs]
> (map apply fs (apply map vector cs)))
This is really nice. Even handles infinity properly:
(supermap (repeat +) (range 3) (range 3))
=> (0 2 4)
Thanks Ken and Meikel!
Mike
--
You receiv
On Fri, Feb 4, 2011 at 10:11 AM, Ken Wesson wrote:
> With juxt it's as Meikel wrote:
>
> (defn supermap [fs & cs]
> (apply map (apply juxt fs) cs))
Or not. Hm, juxt documentation needs clarifying.
> (defn supermap [fs & cs]
> (map apply fs (apply map vector cs)))
--
You received this messag
On Fri, Feb 4, 2011 at 9:19 AM, Mike wrote:
> This is probably a pretty newb question...sorry. I'm looking for the
> idiomatic way to apply a seq of functions to other seqs. In other
> words, a version of map that doesn't take a single f, but a seq of
> them.
>
> (map f c1 c2 ... cn)
> => ((f c1
Or maybe on a second look:
(map apply fs c1 ... cn)?
(user=> (map #(apply %1 %&) [+ - *] [1 2 3] [1 2 3])
(2 0 9)
vs.
user=> (map (juxt + - *) [1 2 3] [1 2 3])
([2 0 1] [4 0 4] [6 0 9])
Sincerely
Meikel
--
You received this message because you are subscribed to the Google
Groups "Clojure" gr
Hi,
(map (juxt f1 f2 f3) c1 c2 c3)
(map (apply juxt fs) c1 c2 c3)
(apply map (apply juxt fs) cs)
Sincerely
Meikel
--
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
This is probably a pretty newb question...sorry. I'm looking for the
idiomatic way to apply a seq of functions to other seqs. In other
words, a version of map that doesn't take a single f, but a seq of
them.
(map f c1 c2 ... cn)
=> ((f c11 c21 ... cn1) (f c12 c22 ... cn2) ... (f c1m c2m ... cnm)