On Tue, Apr 5, 2011 at 8:09 AM, Meikel Brandmeyer <m...@kotka.de> wrote:
> (defn partition-by [f s]
>  (lazy-seq
>    (let [s (seq s)]
>      (if s
>        (let [fs (map f s)
>              eq (cons true (map = fs (rest fs)))
>              eqs (seq (map list eq s))
>              step (fn step [eqs]
>                     (lazy-seq
>                       (let [eqs (seq eqs)]
>                         (if eqs
>                           (cons
>                             (lazy-seq
>                               (cons (second (first eqs))
>                                 (map second (take-while first (rest
> eqs)))))
>                             (step (drop-while first (rest
> eqs))))))))] ; <- The drop-while marks the spot. There is a call to
> seq missing here.
>          (step eqs))))))

I don't think so. I just tested it and adding a call to seq there
causes it to retain more data in memory, longer, not the other way
around.

-- 
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