> (defn death
>   [host]
>   (dosync
>    (if (not (empty? @host))
>      nil)))

The agents initial value is a ref. Sometimes you set it to nil. nil
cannot be dereferenced. Perhaps you meant to set the ref to nil (if
(not-empty @host) (ref-set host nil)).

However I think you've gone a little off track mixing agents and refs
like this. The value of an agent is already thread safe, so there is
no need to protect it with a ref.
(def myagent (agent 5))
(defn death [host] (if host nil))
(send death myagent)

> (defn death
>   [host]
>   (dosync
>      nil))

This just returns nil all the time, no deref is done.



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