How about having your methods access an atom provided in a closure like it's done here: http://kotka.de/blog/2010/03/proxy_gen-class_little_brother.html
U On 14 February 2013 13:58, Joachim De Beule <joachim.de.be...@gmail.com>wrote: > Hi All, > > I want to turn a clojure sequence into an 'EventStream' java interface in > clojure (see > http://opennlp.apache.org/documentation/1.5.2-incubating/apidocs/opennlp-maxent/index.html). > Basically this is an object that implements next() and hasNext() methods. > > I know this can be done with proxy: > > (proxy [EventStream] [] > (hasNext [] ...) > (next [] (Event. ...) ...)) > > What I am not sure about is how to deal with state. More precisely, the > object returned by the above call to proxy obviously must somehow keep a > pointer to the current position in the input sequence and increment the > index after a call to next() etc. > > Any ideas on how to best do something like this? > > Thanks a lot! > Joachim. > > > -- > -- > 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 > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.