-
-
Save gdanov/3f58760866108a412fed570210c25330 to your computer and use it in GitHub Desktop.
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
(defmacro eq [x] | |
`(sp/& | |
(fn [v#] | |
(println "#~" v#) | |
(= v# ~x)) | |
(sp/conformer #(do (println "#" %) %)))) | |
;; twice | |
(sp/conform (sp/cat :a (eq :a)) [:a]) | |
;; 3 times | |
(sp/conform (sp/cat :a (sp/alt :a-a (eq :a))) [:a]) | |
;; 4 times | |
(sp/conform (sp/cat :a (sp/alt :a-a (sp/alt :a-a-a (eq :a)))) [:a]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment