Created
September 27, 2012 07:26
-
-
Save martintrojer/3792665 to your computer and use it in GitHub Desktop.
core.logic goodies
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
(defne not-membero [x l] | |
([_ []]) | |
([_ [h . t]] | |
(!= x h) | |
(not-membero x t))) | |
(defne subseto [s1 s2] | |
([() _]) | |
([[x . xs] _] | |
(membero x s2) | |
(subseto xs s2))) | |
(defna any-membero [s1 s2] | |
([[h . _] _] | |
(membero h s2)) | |
([[_ . t] _] | |
(any-membero t s2))) | |
(defne reverseo | |
"w is reverse of l" | |
[l z w] | |
([() x x]) | |
([[x . y] z w] | |
(fresh [nz] | |
(conso x z nz) | |
(reverseo y nz w)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment