On 24.01.2009, at 16:34, Rich Hickey wrote:

> So, thread-local vars are not what you want.

That's what I figured out in the meantime, and I settled for an array:

(defn int-stream []
   (let [n (into-array [0])]
     (stream
       (fn [_]
        (let [current (aget n 0)]
          (aset n 0 (inc current))
          current)))))

Atoms look like a better approach though.

> Second, generators are not supposed to be aliased - you are supposed
> to create them on the fly and hand them off for ownership by a stream,

Yes, I know, the def was just for quick testing.

Thanks,
   Konrad.


--~--~---------~--~----~------------~-------~--~----~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to