Easy enough to use via lein (thanks for uploading it to clojars BTW).
I think it deserves a place in cc.
--
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
Any interest in moving this to clojure-contrib? It seems like a pretty
useful facility to have for a language like clojure that relies so
heavily
on lazy sequences.
Also, it's an easy way to implement a pretty common parallel
programming pattern, two threads communicating through a buffered
queue.
On Aug 3, 5:28 pm, Jeff Palmucci wrote:
> See my library athttp://github.com/jpalmucci/clj-yield, which makes
> this trivial.
This looks really nice, Jeff. Thanks. Exactly what I was looking
for.
I notice that the garbage-monitor deftype yields a classname error in
IBM Java6. I renamed it to
Right, that'll work, but it is no longer lazy in the sense that it
will read the whole sequence into memory (a problem for me because my
sequences are 10s of GB long, compressed).
The feature I was trying to show is that the "yield" function allows
you to make *arbitrary* non-lazy code lazy. (not
Hi,
On Aug 4, 4:56 pm, Cameron wrote:
> Not 100% on this, but this is what I do when reading files...
>
> (with-open [rdr (BufferedReader. (FileReader. file-name))]
> (reduce conj [] (line-seq rdr)))
An easier way to do this is doall.
> That ensures that the whole seq is realized without c
Not 100% on this, but this is what I do when reading files...
(with-open [rdr (BufferedReader. (FileReader. file-name))]
(reduce conj [] (line-seq rdr)))
That ensures that the whole seq is realized without closing the
handle, but it also allows you to wrap the whole block with a take
function
See my library at http://github.com/jpalmucci/clj-yield, which makes
this trivial.
For example, here is a function I use to read a sequence of java
serialized objects from a stream:
(defn read-objects [path]
(with-yielding [out 1000]
(with-open [stream (java.io.ObjectInputStream.
On Aug 3, 4:40 pm, Brian Hurt wrote:
> So the real answer is: this isn't a good use for seqs.
I was afraid that was the case. Too bad, 'cause seqs are otherwise
elegant. Thanks for the sanity check.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
On Tue, Aug 3, 2010 at 3:21 PM, David Andrews wrote:
> I want to create a lazy seq backed by an open file (or db connection,
> or something else that needs cleanup). I can't wrap the consumer in a
> with-anything.
>
> Is there a general method for cleaning up after the consumer discards
> its re
I want to create a lazy seq backed by an open file (or db connection,
or something else that needs cleanup). I can't wrap the consumer in a
with-anything.
Is there a general method for cleaning up after the consumer discards
its reference to that lazy seq? I'm vaguely aware of Java finalize,
but
10 matches
Mail list logo