-
-
Save kindlychung/c05aa1c9ba9ac2b481f0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def sarah (atom {:name "Sarah" :age 25})) | |
(set-validator! sarah #(when-not (:age %) (throw (IllegalStateException. ":age required")))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You need to return
true
(or a non-false val) if the state is acceptable. You could do this:(set-validator! sarah #(if (:age %) true (throw (IllegalStateException. ":age required"))))
or this:
(set-validator! sarah #(:age %))