Could you post more of your code? If you suspect your code is stopping at the first swap!, it might be an idea to post the contents of get-and-make-move as well.
- James On 14 July 2014 11:25, <edw...@kenworthy.info> wrote: > So I've got something strange happening. > > I have a function (play, see below) which I spin off in a separate thread: > > (future (play {:black black-strategy :white white-strategy} :black)) > > The weird thing is whilst the first (println) in play is printed to the > console, and so is a similar print from the watch I have on current-board, > the play thread seems to stall at that point: I never see "done swap" or > any other prints from play and my UI doesn't update past the initial change > to current-board. > > It's almost as if swap! does it's job but then never returns. > > Any pointers for me? > > > (defn play [player-strategies player] > (println "play called (next is waiting 5 seconds before doing anything.") > (Thread/sleep 5000) > (swap! current-board #(get-and-make-move %1 (player-strategies player) > player)) > (println "done swap!") > (let [next-player (next-to-play @current-board player)] > (if-not next-player > (let [result (count-difference :black)] > (printf "GAME OVER") ;; should > return the result > (print-board @current-board) > ; (print (result-string result)) > (newline) ;) > result) > (recur player-strategies next-player))))) > > -- > 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/d/optout. > -- 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/d/optout.