Created
June 26, 2017 14:22
-
-
Save bhb/c8d01c455494921a3698a9cf951272ff to your computer and use it in GitHub Desktop.
An example of map-of and `in`
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
;;[org.clojure/clojure "1.9.0-alpha17"] | |
;;[org.clojure/clojurescript "1.9.542"] | |
;;[org.clojure/spec.alpha "0.1.123"] | |
(s/def :foo/user-map (s/map-of string? int?)) | |
(s/explain-data :foo/user-map {"hi" "foo"}) | |
;; Actual value: | |
;; #:cljs.spec.alpha{:problems | |
;; ({:path [1], | |
;; :pred int?, | |
;; :val "foo", | |
;; :via [:foo/user-map], | |
;; :in ["hi" 1]})} | |
;; Expected: the `:in` value to be ["hi"] ? | |
(s/explain-data :foo/user-map {:hi 2}) | |
;; Actual value: | |
;; #:cljs.spec.alpha{:problems | |
;; ({:path [0], | |
;; :pred string?, | |
;; :val :hi, | |
;; :via [:foo/user-map], | |
;; :in [:hi 0]})} | |
;; Expected: I'm not sure. I can see the trouble with identifying the key itself. | |
;; Perhaps `[:hi 0]` indicates something like "find the key-value pair for :hi, then | |
;; get the 0th element of that key-value pair (i.e. the key)" ??? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment