On Thu, Nov 20, 2008 at 8:51 PM, islon <[EMAIL PROTECTED]> wrote: > > Thanks for the ideas =) > I'll use agents to represent state (I don't know how I forgot it, > thanks Harrison), they are a lot more concise than refs and make a lot > more sense in my context. > Only one problem: > > user=> (def player (agent {:str 2 :dex 3})) > #=(var user/player) > user=> @player > {:str 2, :dex 3} > user=> (send (:str player) + 1) > java.lang.NullPointerException (NO_SOURCE_FILE:0) > ... > Caused by: java.lang.NullPointerException > at clojure.send__547.doInvoke(boot.clj:1044) > at clojure.lang.RestFn.invoke(RestFn.java:445) > at user.eval__2681.invoke(Unknown Source) > at clojure.lang.Compiler.eval(Compiler.java:4106) > ... 10 more > > Ideas?
It seems unlikely to me that agents are really what you want, but anyway... (send player update-in [:str] inc) (await player) --Chouser --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---