Just started learning about spec and am going through the
guide: https://clojure.org/guides/spec (so I'm using clojure 1.9.0 and have
required clojure.spec.alpha).
They introduced the merge macro with this example:
(s/def :animal/kind string?)
(s/def :animal/says string?)
(s/def :animal/common (s/keys :req [:animal/kind :animal/says]))
(s/def :dog/tail? boolean?)
(s/def :dog/breed string?)
(s/def :animal/dog (s/merge :animal/common
(s/keys :req [:dog/tail? :dog/breed])))
But when I call explain on a data structure that does not conform to these
specs (:dog/breed is not a string in this example), it outputs duplicate
information about the failure. Is this a bug?
(s/explain :animal/dog {:animal/kind "dog" :animal/says "woof" :dog/tail?
true :dog/breed 1})
In: [:dog/breed] val: 1 fails spec: :dog/breed at: [:dog/breed] predicate:
string?
In: [:dog/breed] val: 1 fails spec: :dog/breed at: [:dog/breed] predicate:
string?
Thanks for any and all help!
Lucas
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.