Maybe this version is clearer:

(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)
              head      (map first fst)
              rst-input (map first (drop len rst))
              tail         (lazy-seq (split-at-subsequence mark rst-input))]
            (if (empty? head)
                tail
                (list* head tail)))))

I think it would be better to create the lazy-seq over a function that uses 
the pieces in order to not to explode input with partition-all and 
de-explode it with map-first before the recursive call.

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

Reply via email to