On Apr 6, 2009, at 9:02 AM, bgray wrote:
> > I have a some what (I believe) easy question. Could someone let me > know what I'm doing wrong? A simplified version of what I'm trying to > do looks like this: > > user=> (def foo (ref 0)) > #'user/foo > user=> (defn square [x] (* x x)) > #'user/square > user=> (defn square-ref [x] (dosync (alter foo square x))) > #'user/square-ref > user=> (square-ref 2) > java.lang.IllegalArgumentException: Wrong number of args passed to: > user$square (NO_SOURCE_FILE:0) > Paul and David N. have already given you the right advice. But to help you understand why your square-ref function didn't work, compare it to this: (defn square-ref [x] (dosync (alter foo (fn [_] (square x))))) Do you see the difference? Aloha, David Sletten --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---