-
-
Save bluemont/43216ec4543115c29ee7 to your computer and use it in GitHub Desktop.
Is metadata a good idea here?
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
(ns my-lib.validation | |
"Validation functions" | |
(:refer-clojure :rename {keyword to-keyword})) | |
(defn keyword | |
"If key not nil, is value a keyword?" | |
[k v] | |
{:error "value must be a keyword when key is given"} | |
(if (nil? k) true | |
(keyword? v))) | |
; later, a `validate` function uses the :error metadata |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment