Last active
April 8, 2018 19:51
-
-
Save gfredericks/c1cb1eb415241c106ab54d9cf9aea5de to your computer and use it in GitHub Desktop.
A clojure.spec quine
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
(s/def ::quine | |
((fn [x] | |
(s/cat :the-def #{'s/def} | |
:the-quine #{::quine} | |
:the-spec (s/spec | |
(s/cat :x #{x} | |
:x' (s/spec | |
(s/cat :quote #{'quote} | |
:x #{x})))))) | |
'(fn [x] | |
(s/cat :the-def #{'s/def} | |
:the-quine #{::quine} | |
:the-spec (s/spec | |
(s/cat :x #{x} | |
:x' (s/spec | |
(s/cat :quote #{'quote} | |
:x #{x})))))))) | |
(s/valid? ::quine | |
'(s/def ::quine | |
((fn [x] | |
(s/cat :the-def #{'s/def} | |
:the-quine #{::quine} | |
:the-spec (s/spec | |
(s/cat :x #{x} | |
:x' (s/spec | |
(s/cat :quote #{'quote} | |
:x #{x})))))) | |
'(fn [x] | |
(s/cat :the-def #{'s/def} | |
:the-quine #{::quine} | |
:the-spec (s/spec | |
(s/cat :x #{x} | |
:x' (s/spec | |
(s/cat :quote #{'quote} | |
:x #{x}))))))))) | |
;; => true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment