A related point about the validator function (for Refs), possible the result
of the same change in the  Clojure codebaseOn page 133 of Beta 5.0,

    (def messages (ref () :validator  validate-message-list)
The code samples, using, the  bundled clojure, do work. However, right above
the code on p. 133, the keyword :validate is given instead.

Using the Clojure release of Dec.
17,<http://clojure.googlecode.com/files/clojure_20081217.zip> that
line of code does not work. I get to it work by eliminating the
:validatorkeyword and passing the function as an additional parameter;
following this
documentation http://clojure.org/api#toc434

Joshua




On Fri, Jan 16, 2009 at 5:37 PM, Telman Yusupov <use...@yusupov.com> wrote:

>
> Thank you very much, Stuart!
>
> I think it's a good idea for me to start reading Clojure source code
> and keep track of the changes, as the language changes so quickly...
>
>
> On Jan 16, 10:02 am, Stuart Halloway <stuart.hallo...@gmail.com>
> wrote:
> > 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