Use partition: (map (apply myfcn) (partition 2 [1 2 3 4 5 6 7 8]))
Or something like that. Not at a REPL so that's from memory. Experiment with partition at the repl and it'll become clear. Jim On Jul 21, 9:20 pm, Glen Rubin <rubing...@gmail.com> wrote: > Hi! I want to process a collection 2 elements at a time using map. > > My function accepts 2 parameters (a,b) and returns a result (c): > > (myfcn [a b]) > > => c > > so I want to iterate myfcn over a collection and create a new sequence > > for example let's say myfcn sums a and b, then i would like to do > something like this: > > (map myfcn '(1 2 3 4 5 6 7 8) > > => 3 7 11 15 > > accept i get the error that myfcn is being passed the wrong number of > arguments, since map is passing them in 1 at a time. How do I get map > to pass in 2 at a time? > > thx! -- 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