Created
March 28, 2011 07:22
-
-
Save kencoba/890110 to your computer and use it in GitHub Desktop.
logical operator
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 | |
(:use [clojure.test])) | |
(defmacro implies [p q] `(or (not ~p) ~q)) | |
(deftest test-implies | |
(are [e p q] (= e (implies p q)) | |
true true true | |
false true false | |
true false true | |
true false false)) | |
(defmacro xor [p q] `(or (and ~p (not ~q)) (and (not ~p) ~q))) | |
(deftest test-xor | |
(are [e p q] (= e (xor p q)) | |
false true true | |
true true false | |
true false true | |
false false false)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment