Created
July 20, 2011 10:24
-
-
Save frenchy64/1094728 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
(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