I think what you want is:
(def foo (ref 0))
(defn square [x] (* x x))
(defn square-ref [x] (dosync (ref-set foo (square x))))
(square-ref 2)

On Mon, Apr 6, 2009 at 3:02 PM, bgray <graybran...@gmail.com> 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)
> user=> (doc square)
> -------------------------
> user/square
> ([x])
>  nil
> nil
> user=>
>
> Thanks,
> Brandon
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to