As has been discussed here previously, one way to generate an uncached
stream of numbers is:
(defn incs [i]
  (proxy [clojure.lang.ASeq] []
    (first [] i)
    (next [] (incs (inc i)))))

ASeq implements most of the machinery of sequences, so you can just
implement the parts that differ.

I'd like to replace some of my proxies with the new reify or deftype
constructs in order to benefit from the improved performance.  But as far as
I can tell, there's no way to do that and leverage default implementations
provided by ASeq.

Has anyone here rewritten ASeq as a mixin-map of functions to be used with
extend and reify to avoid the dependence on a base class?  Is there another
approach I'm missing?

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