On 17 February 2010 21:53, metaperl <scheme...@gmail.com> wrote: > > I tried to use :test to constrain the range of a variable, but it > didnt seem to work. Am I misunderstanding the purpose of this keyword?
What you want is set-validator! :test can be used to store a unit test (typically for a function) but you should use clojure.test for writing unit tests, just ignore :test Usage: (set-validator! iref validator-fn) Sets the validator-fn for a var/ref/agent/atom. validator-fn must be nil or a side-effect-free fn of one argument, which will be passed the intended new state on any state change. If the new state is unacceptable, the validator-fn should return false or throw an exception. If the current state (root value if var) is not acceptable to the new validator, an exception will be thrown and the validator will not be changed. -- 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 Note that posts from new members are moderated - please be patient with your first post. 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