I see. Thanks for explaining. If speed is an issue, and if you can assume that indices are properly sorted in ascending order, I believe this looks like a lazy-reduce problem. Clojure has no lazy-reduce (or does it?) so I've written my own:
(defn lazy_reduce [f val coll] (lazy-seq (if (seq coll) (let [val (f val (first coll))] (cons val (lazy_reduce f val (rest coll))))))) (defn split [indices coll] (map first (lazy_reduce nthnext coll (map - indices (cons 0 indices))))) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---