Skip to content

Instantly share code, notes, and snippets.

@swannodette
Created July 9, 2011 20:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save swannodette/1073927 to your computer and use it in GitHub Desktop.
Save swannodette/1073927 to your computer and use it in GitHub Desktop.
appendo.clj
(defne appendo [x y z]
([() _ y])
([[?a . ?d] _ [?a . ?r]] (appendo ?d y ?r)))
;; -----
(defn appendo [x y z]
(fn [a8289]
(inc
(mplus
(bind a8289 (exist [] (fn [a__3142__auto__]
(if-let [b__3143__auto__ (unify a__3142__auto__ () x)]
b__3143__auto__
nil)) (exist [] (fn [a__3142__auto__]
(if-let [b__3143__auto__ (unify a__3142__auto__ y z)]
b__3143__auto__
nil)))))
(fn []
(bind
a8289
(exist
[?a ?d]
(fn [a__3142__auto__]
(if-let [b__3143__auto__ (unify a__3142__auto__ (llist ?a ?d) x)]
b__3143__auto__
nil))
(exist [?r] (fn [a__3142__auto__]
(if-let [b__3143__auto__ (unify a__3142__auto__ (llist ?a ?r) z)]
b__3143__auto__
nil)) (appendo ?d y ?r)))))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment