This is not the idiomatic way but you can stay quite close from your code by:
(defn game [ board ]
(fn [n i]
(cond
(= n :x) (game (assoc board i 'x))
( = n :o) (game (assoc board i 'o))
(= n :print) (println board))))
(defn (new-game (game (into [] (repeat 9 nil)))))
But this is still an encoding of message-passing OO, which is not very
idiomatic.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en