Thanks for the replies. Indeed, I have been approaching the issue with
destructuring, as suggested. It still seems to me that reduce* is
consistent with the behaviour of map, in that it is polyvariadic and
doesn't require packing arguments into and out of a single sequence.
However, its good to know the destructuring approach is more or less
the obvious way to go about things, and I am not overlooking an
idiomatic approach.

On Jun 12, 3:53 am, Jürgen Hötzel <juer...@hoetzel.info> wrote:
> 2010/6/11 Nathan Sorenson <n...@sfu.ca>:
>
> > Is there a way to fold over multiple sequences, in the same way that
> > 'map' can apply a multi-parameter function over several seqs? In other
> > words, is there a function like this:
>
> There is no need for a special purpose reduce* function.
> Using destructing binding as Sean explains and creating an
> intermediate lazy sequence of key/value pairs, this leads to short and
> concise code:
>
> (reduce (fn [m [k v]] (assoc m k v)) {} (map vector [:one :another]
> (iterate inc 1)))
>
> A good example of Alan J. Perlis quote and  Clojure rationale:
>
> "It is better to have 100 functions operate on one data structure than
> to have 10 functions operate on 10 data structures."
>
> Jürgen

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