I want to look at the data-structure which represents a Clojure Spec.
How can I get and have a look in it?
Eg. given
(s/def ::myspec (s/keys :opt-un [::x ::y]))
I want to pretty print the internal representation of myspec.
I want to look at the data-structure which represents a Clojure Spec.
How can I get and have a look in it?
Eg. given
(s/def ::myspec (s/keys :opt-un [::x ::y]))
I want to pretty print the internal representation of myspec.
Copyright © 2021 Jogjafile Inc.
You can use
s/formwhich "return[s] the spec as data":Or
s/describefor an abbreviated version of the same thing:Both these ultimately depend on the
describe*method of theSpecprotocol:So each spec type is responsible for describing itself. For example the map spec implementation just rebuilds its literal definition from its initial inputs like this: