REPL, refs and casting

2010-03-10 Thread Mike Erickson
I am seeing a difference in running the contents of a function vs. running the function by name in a REPL. I am writing a simple blackjack game in Clojure, and have a ref called 'cards' for representing the state of the game. I initialize it this way: user (dosync (alter cards assoc     :deck

Re: REPL, refs and casting

2010-03-10 Thread Timothy Pratley
On 10 March 2010 21:03, Mike Erickson mike.erick...@gmail.com wrote: but calling (deal 2 :house) bombs out with the following stacktrace: Hi Mike, I tried running your code and it worked fine for me... so I think something else is playing tricks on you here like maybe you changed the function

Re: REPL, refs and casting

2010-03-10 Thread Timothy Pratley
On 11 March 2010 17:10, Timothy Pratley timothyprat...@gmail.com wrote: I tried running your code and it worked fine for me... Ah excuse me it only 'worked' because I used vectors instead of lists: [5 \S]]] [:player []]), :house ([:house []]), :deck nil} --- should give you the clue you need,

Re: REPL, refs and casting

2010-03-10 Thread Timothy Pratley
On 11 March 2010 17:15, Timothy Pratley timothyprat...@gmail.com wrote: You probably want to use conj instead of concat! Actually ignore that! I was being confused by the deck-building. Can you try running this code: http://gist.github.com/328912 It is exactly the same as yours but uses known

Re: REPL, refs and casting

2010-03-10 Thread Timothy Pratley
Hi Mike, On 10 March 2010 21:03, Mike Erickson mike.erick...@gmail.com wrote: I am writing a simple blackjack game in Clojure I've written up a little commentary as to how I'd approach this problem differently: http://gist.github.com/328929 which hopefully will give you some ideas. The general