Here's my take:
(defn mmap [f coll]
(->> coll
(partition 2)
(map (fn [[x y]] (f x y)))))
For instance:
user> (mmap + (range 8))
(1 5 9 13)
user> (mmap * (range 8))
(0 6 20 42)
You probably want to think about whether you'll see input sequences
with an odd number of terms, and how best to handle them.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en