Clojure: finding sequential items from a sequence

Posted by Ralph on Stack Overflow See other posts from Stack Overflow or by Ralph
Published on 2010-04-27T12:04:31Z Indexed on 2010/04/27 13:43 UTC
Read the original article Hit count: 301

Filed under:
|

In a Clojure program, I have a sequence of numbers:

(2 3 4 6 8 1)

I want to find the longest sub-sequence where the items are sequential:

(2 3 4)

I am assuming that it will involve (take-while ...) or (reduce ...).

Any ideas?

© Stack Overflow or respective owner

Related posts about clojure

Related posts about reduce