On Jan 3, 10:14 am, "Mark Volkmann" <r.mark.volkm...@gmail.com> wrote:
> What do you think of this way of resolving the issue? Note the use of the 
> local variable "message". That can get set to either "You win!" or "You 
> killed the snake!" inside dosync. Then outside dosync I check that and call 
> new-game only if it's set.

That is correct with respect to transactions.  I guess I would
structure the code differently:  I would treat each move as a function
M: state -> (state, {win, loss, continue}) and check the second return
value for win or loss each time.  M can be a pure function, except for
the IO and for telling, say, a display agent about the new state of
the world.  But your way works too.  I'm not sure which is better.

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