Created
February 7, 2013 22:59
-
-
Save swannodette/4735012 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
(defnc evenc [x] | |
(even? x)) | |
(defnc div3c [x] | |
(zero? (mod x 3))) | |
;; constrain ?a & ?b so that they must both be even and divisible by 3 | |
(u/unify {:when {'#{?a ?b} [evenc div3c]}} | |
['{:a ?a :b ?b} {:a 6 :b 12}]) | |
;; => {:a 6 :b 12} | |
(u/unify {:when {'#{?a ?b} [evenc div3c]}} | |
['{:a ?a :b ?b} {:a 2 :b 6}]) | |
;; => nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment