One variation making the lazy-sequence only over the pieces: (defn split-at-subsequence [mark input] (let [len (count mark) split-at-subseq (fn split-at-subseq [pieces] (when (seq pieces) (let [[fst rst] (split-with #(not= mark %) pieces) head (map first fst) rst-pieces (drop len rst) tail (lazy-seq (split-at-subseq rst-pieces))] (if (empty? head) tail (list* head tail)))))] (when-let [sequence (seq input)] (split-at-subseq (partition-all len 1 sequence)))))
I suppose it is better to define a private function for the computation of the lazy-sequence than define it inside the let. Juan Manuel -- 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en