Created
January 10, 2019 18:15
-
-
Save bostonaholic/6490a1132941dca2b62b28996a3bf1ea to your computer and use it in GitHub Desktop.
conforming `s/or` clojure specs
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
user=> (s/def ::name string?) | |
:user/name | |
user=> (s/def ::id int?) | |
:user/id | |
user=> (s/conform ::name "bob ross") | |
"bob ross" | |
user=> (s/conform ::id 42) | |
42 | |
user=> (s/def ::name-or-id (s/or ::name2 string? ::id2 int?)) | |
:user/name-or-id | |
user=> (s/conform ::name-or-id "bob ross") | |
[:user/name2 "bob ross"] | |
user=> (s/conform ::name-or-id 42) | |
[:user/id2 42] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment