Hi, Am 18.01.2009 um 15:24 schrieb bOR_:
I'm running into an odd error that occasionally pops up. Here is the ugly script and the two functions, one for which it does, and one for which it does not pop up. Anyone has a clue? (defn death [host] (dosync (if (not (empty? @host)) nil))) (defn death [host] (dosync nil))
The value of the agent is replaced by the return value of the function sent to it. Your functions both return nil. So in first the invocation your agent contains a ref to nil, which is passed to your function. But then the ref is replaced by nil itself. Hence in the second invocation your function gets passed nil itself instead of a ref. Then @host, which expands to (deref host) throws the exception, because host is nil and not a ref. The second function simply works, because you do not deref the "ref". Hence no problem. Sincerely Meikel
smime.p7s
Description: S/MIME cryptographic signature