If you've got a sorted list of numbers, for example:
[1 3 4 5 7 9 10 13]
where some are consecutive, how can you pull out the consecutive runs? That
is, either produce
[1 [3 4 5] 7 [9 10] 13] ; or maybe something like
[[1 7 13] [3 4 5] [9 10]] ; (the first vec is the elements left over)
from the original coll?
I can do it in Python in an imperative style, but it's a bit messy. My
hunch is that there's probably a shorter way in Clojure, but I'm not seeing
it.
Thanks!
--
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
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.