Hi Andy and all,
Here's mine with trying to separate steps.
You can see each steps with commenting out later steps.
(fn [coll]
(->> coll
; 1st. Make tails of coll.
(#(take-while (comp not nil?) (iterate next %)))
; 2nd. Take only consecutive elements from the head for each list.
(map (fn [[c & cs]]
(loop [[x & xs] cs acc [c] z c]
(if (= (inc z) x) (recur xs (conj acc x) x) acc))))
; 3rd. Take only vectors having 2 or more elements.
(filter #(< 1 (count %)))
; 4th. Take the longest
(reduce #(if (< (count %2) (count %)) % %2) [])
))
https://gist.github.com/2928234
Regards,
Yoshinori Kohyama
--
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