Skip to content

Instantly share code, notes, and snippets.

@martintrojer
Created September 27, 2012 07:26
Show Gist options
  • Save martintrojer/3792665 to your computer and use it in GitHub Desktop.
Save martintrojer/3792665 to your computer and use it in GitHub Desktop.
core.logic goodies
(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