Very basic question. What's the idiom for producing a new seq wherein each val is based on pairs from an existing seq, e.g.:
; add together n0 n1, n1 n2, n2 n3, etc. [1 2 3 4 5 6] ; giving... [3 5 7 9 11] The verbose way would be something like: (loop [s origSeq n [ ]) (let [a (first origSeq) b (second origSeq)] (if (nil? b) n (recur (rest origSeq) (conj n (+ a b)))))) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---