Created
December 14, 2011 23:34
-
-
Save iskandr/1479118 to your computer and use it in GitHub Desktop.
logical operators
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
val rec iter = fn 0 => (fn f => fn x => x) | n => (fn f => fn x => (f o (iter (n-1) f)) x); |
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
fun conj x y = case (x,y) of (true, true) => true | _ => false; | |
fun disj x y = case (x,y) of (true, _) => true | (_, true) => true | _ => false; | |
fun impl x y = case (x,y) of (false, _) => true | (true, true) => true | _ => false; | |
fun equiv x y = case (x,y) of (false, false) => true | (true, true) => true | _ => false; |
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
fun semifac n = reduce ((op * ), 1, 1, (n div 2), (fn x => 2 * x + n mod 2)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment