I'd like to offer the following version of interpose as a replacement for the current interpose in boot.clj. It's been useful for me and I think it may be for others.
(defn intpose "(intpose n sep coll) Returns a lazy seq of the elements of coll separated by sep, with sep inserted after every n items from coll. (intpose sep coll) Same as (intpose 1 sep coll)" ([n sep coll] (let [intfn (fn intfn [i sep coll] (if coll (lazy-cons (if (zero? i) sep (first coll)) (if (zero? i) (intfn n sep coll) (intfn (dec i) sep (rest coll))))))] (if (> n 0) (intfn n sep coll) coll))) ([sep coll] (intpose 1 sep coll))) (take 10 (intpose 2 "b" (repeat "a"))) => (a a b a a b a a b a) --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---