Skip to content

Instantly share code, notes, and snippets.

@frenchy64
Created July 20, 2011 10:24
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 frenchy64/1094728 to your computer and use it in GitHub Desktop.
Save frenchy64/1094728 to your computer and use it in GitHub Desktop.
(ns logic-introduction.core
(:refer-clojure :exclude [inc reify ==])
(:use [clojure.core.logic minikanren prelude nonrel match disequality]))
(defn geto [key env value]
"Succeed if type association [key :- value] is found in vector env."
(matche [env]
([[[key :- value] . _]])
([[_ . ?rest]] (geto key ?rest value))))
(comment
(run* [q]
(exist [a]
(geto 'c
[['f :- [Integer :- Float]]
a
['b :- Integer]
['c :- Integer]
['d :- Integer]]
Integer)
(== q a)))
;=> ([c :- java.lang.Integer] _.0)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment