Hi Telman,

The signature for agent has changed. Use:

       (def counter (agent 0 :validator number?))

I will update the prose in Beta 6.

Stuart

> I keep running into the following problem trying to supply agent
> validation function. Here is sample code from page 135 (from book
> version beta 5)
>
> (use '[clojure.contrib.except :only (throw-if)])
> (def counter (agent 0 #(throw-if (not (number? %)) "not a number")))
>
> triggers the following exception:
>
> java.lang.IllegalArgumentException: No value supplied for key: user
> $fn__1...@89f302 (NO_SOURCE_FILE:2)
> [Thrown class clojure.lang.Compiler$CompilerException]
>
> I’m using the latest versions of clojure (r1216) and clojure-contrib
> (r374) on Mac OS X 10.5.6, Java version "1.5.0_16"
>
> Many thanks,
>
> Telman
>
>
>
> On Jan 16, 8:49 am, Stuart Halloway <stuart.hallo...@gmail.com> wrote:
>> Long, long ago (Tuesday) when Beta 5 of the book shipped, there were
>> some breakages in the sample code due to changes in clojure- 
>> contrib. I
>> believe everything is now fixed in the github repository 
>> (http://github.com/stuarthalloway/programming-clojure
>> ).
>>
>> Summary of the issues:
>>
>> 1. clojure.contrib.seq-util/includes? changed the argument order for
>> consistency with other operations. This caused problems with the
>> snippet web app; Compojure is now updated to match the change in
>> contrib.
>>
>> 2. clojure.contrib.sql/with-results has been removed and replaced  
>> with
>> with-query-results. This broke the snippet model. The code is now
>> fixed and I will update the prose in the next Beta.
>>
>> 3. A change to clojure.lang.Util necessitated a _clean_ rebuild of
>> contrib and compojure. I have rebuild these dependencies in the lib
>> directory.
>>
>> 4. A change to clojure.contrib.test-is.is broke a few unit tests. The
>> book doesn't reference any of these tests directly, but they are now
>> fixed in the code. You can run the whole test suite with ./ 
>> runtests.sh.
>>
>> Let me know if  you find any other issues!
>>
>> Thanks,
>> Stuart
> >


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