Re: REPL, refs and casting

2010-03-10 Thread Timothy Pratley
Hi Mike, On 10 March 2010 21:03, Mike Erickson 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 thrust being to keep yo

Re: REPL, refs and casting

2010-03-10 Thread Timothy Pratley
On 11 March 2010 17:15, Timothy Pratley 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 starting conditions... and

Re: REPL, refs and casting

2010-03-10 Thread Timothy Pratley
On 11 March 2010 17:10, Timothy Pratley 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, You probably want to

Re: REPL, refs and casting

2010-03-10 Thread Timothy Pratley
On 10 March 2010 21:03, Mike Erickson 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 in your text buffer but

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 (bu