I've been writing a few different functions that return and operate on
some very long sequences. Everything I've been doing has been written
in terms of underlying operations that are described as lazy, so I
assumed everything would be fine as long as I don't retain the head of
any sequences.

However, I'm running out of heap space using the following function to
filter my sequences:

(defn documents-from-vendors [doc-seq m]
  (filter
   (fn [document]
     (let [item (. document get Constants/ITEM_ID)]
       (contains? m item)))
   doc-seq))

I know that filter is lazy, and I see that the documentation of lazy-
cons says that lazy-conses are cached. Cached for what duration ? Does
this mean that filter is not appropriate for use on long sequences, or
is there something else likely to be going on here?

Thanks for your help!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to