aboutsummaryrefslogtreecommitdiff
path: root/src/algebra
diff options
context:
space:
mode:
Diffstat (limited to 'src/algebra')
-rw-r--r--src/algebra/boolean.spad.pamphlet20
-rw-r--r--src/algebra/strap/BOOLEAN.lsp88
2 files changed, 55 insertions, 53 deletions
diff --git a/src/algebra/boolean.spad.pamphlet b/src/algebra/boolean.spad.pamphlet
index 75b5b325..b4ecb100 100644
--- a/src/algebra/boolean.spad.pamphlet
+++ b/src/algebra/boolean.spad.pamphlet
@@ -375,20 +375,18 @@ Boolean(): Join(OrderedFinite, Logic, PropositionalLogic, ConvertibleTo InputFor
test: % -> %
++ test(b) returns b and is provided for compatibility with the new compiler.
== add
- nt: % -> %
-
test a == a
- nt b == (b => false; true)
+ nt(a: %): % == NOT(a)$Lisp
true == 'T pretend %
false == NIL$Lisp
sample() == true
- not b == NOT(b)$Lisp
+ not b == nt b
_~ b == (b => false; true)
_and(a, b) == AND(a,b)$Lisp
- _/_\(a, b) == (a => b; false)
+ _/_\(a, b) == AND(a,b)$Lisp
_or(a, b) == OR(a,b)$Lisp
- _\_/(a, b) == (a => true; b)
+ _\_/(a, b) == OR(a,b)$Lisp
xor(a, b) == (a => nt b; b)
nor(a, b) == (a => false; nt b)
nand(a, b) == (a => nt b; true)
@@ -409,12 +407,14 @@ Boolean(): Join(OrderedFinite, Logic, PropositionalLogic, ConvertibleTo InputFor
true
convert(x:%):InputForm ==
- x => convert("true"::Symbol)
- convert("false"::Symbol)
+ convert
+ x => 'true
+ 'false
coerce(x:%):OutputForm ==
- x => message "true"
- message "false"
+ outputForm
+ x => 'true
+ 'false
@
diff --git a/src/algebra/strap/BOOLEAN.lsp b/src/algebra/strap/BOOLEAN.lsp
index 882c8a74..93546360 100644
--- a/src/algebra/strap/BOOLEAN.lsp
+++ b/src/algebra/strap/BOOLEAN.lsp
@@ -9,6 +9,8 @@
(DECLAIM (FTYPE (FUNCTION (|%Boolean| |%Shell|) |%Boolean|)
|BOOLEAN;nt|))
+(PUT '|BOOLEAN;nt| '|SPADreplace| 'NOT)
+
(DECLAIM (FTYPE (FUNCTION (|%Shell|) |%Boolean|) |BOOLEAN;true;$;3|))
(PUT '|BOOLEAN;true;$;3| '|SPADreplace| '(XLAM NIL 'T))
@@ -33,6 +35,8 @@
(DECLAIM (FTYPE (FUNCTION (|%Boolean| |%Boolean| |%Shell|) |%Boolean|)
|BOOLEAN;/\\;3$;8|))
+(PUT '|BOOLEAN;/\\;3$;8| '|SPADreplace| 'AND)
+
(DECLAIM (FTYPE (FUNCTION (|%Boolean| |%Boolean| |%Shell|) |%Boolean|)
|BOOLEAN;or;3$;9|))
@@ -41,6 +45,8 @@
(DECLAIM (FTYPE (FUNCTION (|%Boolean| |%Boolean| |%Shell|) |%Boolean|)
|BOOLEAN;\\/;3$;10|))
+(PUT '|BOOLEAN;\\/;3$;10| '|SPADreplace| 'OR)
+
(DECLAIM (FTYPE (FUNCTION (|%Boolean| |%Boolean| |%Shell|) |%Boolean|)
|BOOLEAN;xor;3$;11|))
@@ -87,7 +93,7 @@
(DEFUN |BOOLEAN;test;2$;1| (|a| $) (DECLARE (IGNORE $)) |a|)
-(DEFUN |BOOLEAN;nt| (|b| $) (COND (|b| 'NIL) ('T 'T)))
+(DEFUN |BOOLEAN;nt| (|a| $) (DECLARE (IGNORE $)) (NOT |a|))
(DEFUN |BOOLEAN;true;$;3| ($) (DECLARE (IGNORE $)) 'T)
@@ -101,22 +107,26 @@
(DECLARE (IGNORE $))
(AND |a| |b|))
-(DEFUN |BOOLEAN;/\\;3$;8| (|a| |b| $) (COND (|a| |b|) ('T 'NIL)))
+(DEFUN |BOOLEAN;/\\;3$;8| (|a| |b| $)
+ (DECLARE (IGNORE $))
+ (AND |a| |b|))
(DEFUN |BOOLEAN;or;3$;9| (|a| |b| $)
(DECLARE (IGNORE $))
(OR |a| |b|))
-(DEFUN |BOOLEAN;\\/;3$;10| (|a| |b| $) (COND (|a| 'T) ('T |b|)))
+(DEFUN |BOOLEAN;\\/;3$;10| (|a| |b| $)
+ (DECLARE (IGNORE $))
+ (OR |a| |b|))
(DEFUN |BOOLEAN;xor;3$;11| (|a| |b| $)
- (COND (|a| (|BOOLEAN;nt| |b| $)) ('T |b|)))
+ (COND (|a| (NOT |b|)) ('T |b|)))
(DEFUN |BOOLEAN;nor;3$;12| (|a| |b| $)
- (COND (|a| 'NIL) ('T (|BOOLEAN;nt| |b| $))))
+ (COND (|a| 'NIL) ('T (NOT |b|))))
(DEFUN |BOOLEAN;nand;3$;13| (|a| |b| $)
- (COND (|a| (|BOOLEAN;nt| |b| $)) ('T 'T)))
+ (COND (|a| (NOT |b|)) ('T 'T)))
(DEFUN |BOOLEAN;=;3$;14| (|a| |b| $)
(DECLARE (IGNORE $))
@@ -128,8 +138,7 @@
(DECLARE (IGNORE $))
(EQ |a| |b|))
-(DEFUN |BOOLEAN;<;3$;17| (|a| |b| $)
- (COND (|b| (|BOOLEAN;nt| |a| $)) ('T 'NIL)))
+(DEFUN |BOOLEAN;<;3$;17| (|a| |b| $) (COND (|b| (NOT |a|)) ('T 'NIL)))
(DEFUN |BOOLEAN;size;Nni;18| ($) (DECLARE (IGNORE $)) 2)
@@ -142,17 +151,10 @@
(COND ((SPADCALL (|random|) (|getShellEntry| $ 26)) 'NIL) ('T 'T)))
(DEFUN |BOOLEAN;convert;$If;22| (|x| $)
- (COND
- (|x| (SPADCALL (SPADCALL "true" (|getShellEntry| $ 33))
- (|getShellEntry| $ 35)))
- ('T
- (SPADCALL (SPADCALL "false" (|getShellEntry| $ 33))
- (|getShellEntry| $ 35)))))
+ (SPADCALL (COND (|x| '|true|) ('T '|false|)) (|getShellEntry| $ 33)))
(DEFUN |BOOLEAN;coerce;$Of;23| (|x| $)
- (COND
- (|x| (SPADCALL "true" (|getShellEntry| $ 38)))
- ('T (SPADCALL "false" (|getShellEntry| $ 38)))))
+ (SPADCALL (COND (|x| '|true|) ('T '|false|)) (|getShellEntry| $ 36)))
(DEFUN |Boolean| ()
(PROG ()
@@ -176,7 +178,7 @@
(RETURN
(PROGN
(LETT |dv$| '(|Boolean|) . #0=(|Boolean|))
- (LETT $ (|newShell| 41) . #0#)
+ (LETT $ (|newShell| 40) . #0#)
(|setShellEntry| $ 0 |dv$|)
(|setShellEntry| $ 3
(LETT |pv$| (|buildPredVector| 0 0 NIL) . #0#))
@@ -198,16 +200,16 @@
|BOOLEAN;<;3$;17| (|NonNegativeInteger|)
|BOOLEAN;size;Nni;18| (|Integer|) (0 . |even?|)
(|PositiveInteger|) |BOOLEAN;index;Pi$;19|
- |BOOLEAN;lookup;$Pi;20| |BOOLEAN;random;$;21| (|String|)
- (|Symbol|) (5 . |coerce|) (|InputForm|) (10 . |convert|)
- |BOOLEAN;convert;$If;22| (|OutputForm|) (15 . |message|)
- |BOOLEAN;coerce;$Of;23| (|SingleInteger|))
- '#(~= 20 ~ 26 |xor| 31 |true| 37 |test| 41 |size| 46 |random|
- 50 |or| 54 |not| 60 |nor| 65 |nand| 71 |min| 77 |max| 87
- |lookup| 97 |latex| 102 |index| 107 |implies| 112 |hash|
- 118 |false| 123 |equiv| 127 |convert| 133 |coerce| 138
- |and| 143 |\\/| 149 >= 155 > 161 = 167 <= 173 < 179 |/\\|
- 185)
+ |BOOLEAN;lookup;$Pi;20| |BOOLEAN;random;$;21| (|Symbol|)
+ (|InputForm|) (5 . |convert|) |BOOLEAN;convert;$If;22|
+ (|OutputForm|) (10 . |outputForm|) |BOOLEAN;coerce;$Of;23|
+ (|String|) (|SingleInteger|))
+ '#(~= 15 ~ 21 |xor| 26 |true| 32 |test| 36 |size| 41 |random|
+ 45 |or| 49 |not| 55 |nor| 60 |nand| 66 |min| 72 |max| 82
+ |lookup| 92 |latex| 97 |index| 102 |implies| 107 |hash|
+ 113 |false| 118 |equiv| 122 |convert| 128 |coerce| 133
+ |and| 138 |\\/| 144 >= 150 > 156 = 162 <= 168 < 174 |/\\|
+ 180)
'NIL
(CONS (|makeByteWordVec2| 1 '(0 0 0 0 0 0 0 0 0))
(CONS '#(NIL |OrderedSet&| NIL NIL |Logic&|
@@ -215,21 +217,21 @@
(CONS '#((|OrderedFinite|) (|OrderedSet|)
(|PropositionalLogic|) (|Finite|)
(|Logic|) (|SetCategory|)
- (|ConvertibleTo| 34) (|BasicType|)
- (|CoercibleTo| 37))
- (|makeByteWordVec2| 40
- '(1 25 18 0 26 1 32 0 31 33 1 34 0 32
- 35 1 37 0 31 38 2 0 18 0 0 1 1 0 0 0
- 10 2 0 0 0 0 15 0 0 0 7 1 0 0 0 6 0 0
- 23 24 0 0 0 30 2 0 0 0 0 13 1 0 0 0 9
- 2 0 0 0 0 16 2 0 0 0 0 17 0 0 0 1 2 0
- 0 0 0 1 0 0 0 1 2 0 0 0 0 1 1 0 27 0
- 29 1 0 31 0 1 1 0 0 27 28 2 0 0 0 0
- 20 1 0 40 0 1 0 0 0 8 2 0 0 0 0 21 1
- 0 34 0 36 1 0 37 0 39 2 0 0 0 0 11 2
- 0 0 0 0 14 2 0 18 0 0 1 2 0 18 0 0 1
- 2 0 18 0 0 19 2 0 18 0 0 1 2 0 18 0 0
- 22 2 0 0 0 0 12)))))
+ (|ConvertibleTo| 32) (|BasicType|)
+ (|CoercibleTo| 35))
+ (|makeByteWordVec2| 39
+ '(1 25 18 0 26 1 32 0 31 33 1 35 0 31
+ 36 2 0 18 0 0 1 1 0 0 0 10 2 0 0 0 0
+ 15 0 0 0 7 1 0 0 0 6 0 0 23 24 0 0 0
+ 30 2 0 0 0 0 13 1 0 0 0 9 2 0 0 0 0
+ 16 2 0 0 0 0 17 0 0 0 1 2 0 0 0 0 1 0
+ 0 0 1 2 0 0 0 0 1 1 0 27 0 29 1 0 38
+ 0 1 1 0 0 27 28 2 0 0 0 0 20 1 0 39 0
+ 1 0 0 0 8 2 0 0 0 0 21 1 0 32 0 34 1
+ 0 35 0 37 2 0 0 0 0 11 2 0 0 0 0 14 2
+ 0 18 0 0 1 2 0 18 0 0 1 2 0 18 0 0 19
+ 2 0 18 0 0 1 2 0 18 0 0 22 2 0 0 0 0
+ 12)))))
'|lookupComplete|))
(MAKEPROP '|Boolean| 'NILADIC T)