On Aug 25, 9:16 pm, John <[EMAIL PROTECTED]> wrote:
> For each element, get element and next element (incrementing index by
> one, not two), operate on the two, returning a new collection.
> There's the brute force method, but I'm wondering if map or for or any
> of their ilk can pull pairs at a time out of a collection, moving
> across the collection one element at a time.
partition can return a lazy sequence of sets of elements, walking by
an arbitrary step:
(partition 2 1 (range 10))
-> ((0 1) (1 2) (2 3) (3 4) (4 5) (5 6) (6 7) (7 8) (8 9))
Rich
--~--~---------~--~----~------------~-------~--~----~
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
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
-~----------~----~----~----~------~----~------~--~---