Another non-standard solution you could try is to use the state monad from the monad library. On Apr 21, 2012 3:22 PM, "Sergey Didenko" <sergey.dide...@gmail.com> wrote:
> There is also a non-idiomatic way - transform your code to use a > native Java data structure like ArrayList or primitive array. > > You may want it for the speed or if the mutable algorithm is more > readable. Anyway isolation of the mutable code is always a good > advice. > > (defn new-game [] > > (let [board (java.util.ArrayList. (repeat 9 nil))] > > (fn [n i] > > (cond > > (= n :x)(.set board i 'x) > > (= n :o)(.set board i 'o) > > (= n :print) (println board))))) > > -- > 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 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