One implementation using only one recursive function and the sequence
library:
(defn split-at-subsequence [mark input]
(when-let [sequence (seq input)]
(let [len (count mark)
pieces (partition-all len 1 sequence)
[fst rst] (split-with #(not= mark %) pieces)
fst (map first fst)
rst (map first (drop len rst))]
(remove empty?
(lazy-seq
(list* fst
(split-at-subsequence mark rst)))))))
I've created https://gist.github.com/1901772 for the code.
Hope this helps,
Juan Manuel
--
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