diff options
Diffstat (limited to 'src/algebra')
-rw-r--r-- | src/algebra/boolean.spad.pamphlet | 17 | ||||
-rw-r--r-- | src/algebra/pattern.spad.pamphlet | 4 | ||||
-rw-r--r-- | src/algebra/si.spad.pamphlet | 12 | ||||
-rw-r--r-- | src/algebra/string.spad.pamphlet | 8 |
4 files changed, 10 insertions, 31 deletions
diff --git a/src/algebra/boolean.spad.pamphlet b/src/algebra/boolean.spad.pamphlet index 7db25b9f..e3c6ab7f 100644 --- a/src/algebra/boolean.spad.pamphlet +++ b/src/algebra/boolean.spad.pamphlet @@ -534,16 +534,7 @@ Boolean(): Join(OrderedFinite, PropositionalLogic, ConvertibleTo InputForm) with ++ Description: \spadtype{IndexedBits} is a domain to compactly represent ++ large quantities of Boolean data. -IndexedBits(mn:Integer): BitAggregate() with - -- temporaries until parser gets better - Not: % -> % - ++ Not(n) returns the bit-by-bit logical {\em Not} of n. - Or : (%, %) -> % - ++ Or(n,m) returns the bit-by-bit logical {\em Or} of - ++ n and m. - And: (%, %) -> % - ++ And(n,m) returns the bit-by-bit logical {\em And} of - ++ n and m. +IndexedBits(mn:Integer): BitAggregate() == add import %2bool: NonNegativeInteger -> Boolean from Foreign Builtin import %2bit: Boolean -> NonNegativeInteger from Foreign Builtin @@ -589,9 +580,9 @@ IndexedBits(mn:Integer): BitAggregate() with elt(v:%, i:Integer) == %2bool %bitvecref(v,range(v,i-mn)) - Not v == %bitvecnot v - And(u, v) == (#v=#u => %bitvecand(v,u); map("and",v,u)) - Or(u, v) == (#v=#u => %bitvecor(v,u); map("or", v,u)) + ~v == %bitvecnot v + u /\ v == (#v=#u => %bitvecand(v,u); map("and",v,u)) + u \/ v == (#v=#u => %bitvecor(v,u); map("or", v,u)) @ \section{domain BITS Bits} diff --git a/src/algebra/pattern.spad.pamphlet b/src/algebra/pattern.spad.pamphlet index f3368758..254ed1f3 100644 --- a/src/algebra/pattern.spad.pamphlet +++ b/src/algebra/pattern.spad.pamphlet @@ -195,7 +195,7 @@ Pattern(R:SetCategory): Exports == Implementation where generic? p == symbol? p and bitSet?(p.pat.sym.tag, SYM_GENERIC) multiple? p == symbol? p and bitSet?(p.pat.sym.tag,SYM_MULTIPLE) optional? p == symbol? p and bitSet?(p.pat.sym.tag,SYM_OPTIONAL) - bitSet?(a, b) == And(a, b) ~= 0 + bitSet?(a, b) == (a /\ b) ~= 0 coerce(p:%):O == PAT2O(p.pat) p1:% ** p2:% == taggedElt(PAT_EXPT, [p1, p2]) LPAT2O(f, l) == reduce(f, [x::O for x in l])$List(O) @@ -377,7 +377,7 @@ Pattern(R:SetCategory): Exports == Implementation where c? => [0, t, empty(), empty()] mlt := (m? => SYM_MULTIPLE; 0) opt := (o? => SYM_OPTIONAL; 0) - [Or(Or(SYM_GENERIC, mlt), opt), t, empty(), empty()] + [(SYM_GENERIC \/ mlt) \/ opt, t, empty(), empty()] patternVariable(sy, c?, o?, m?) == rsy := mkrsy(sy, c?, o?, m?) diff --git a/src/algebra/si.spad.pamphlet b/src/algebra/si.spad.pamphlet index 7b58a44f..4e3524b4 100644 --- a/src/algebra/si.spad.pamphlet +++ b/src/algebra/si.spad.pamphlet @@ -195,15 +195,6 @@ SingleInteger(): Join(IntegerNumberSystem,OrderedFinite,BooleanLogic) with xor: (%, %) -> % ++ xor(n,m) returns the bit-by-bit logical {\em xor} of ++ the single integers n and m. - Not : % -> % - ++ Not(n) returns the bit-by-bit logical {\em not} of the single integer n. - And : (%,%) -> % - ++ And(n,m) returns the bit-by-bit logical {\em and} of - ++ the single integers n and m. - Or : (%,%) -> % - ++ Or(n,m) returns the bit-by-bit logical {\em or} of - ++ the single integers n and m. - == SubDomain(Integer, %ismall?(#1)$Foreign(Builtin)) add import %icst0: % from Foreign Builtin @@ -251,10 +242,7 @@ SingleInteger(): Join(IntegerNumberSystem,OrderedFinite,BooleanLogic) with not(x) == %bitnot x x /\ y == %bitand(x,y) x \/ y == %bitior(x,y) - Not(x) == %bitnot x - And(x,y) == %bitand(x,y) x and y == %bitand(x,y) - Or(x,y) == %bitior(x,y) x or y == %bitior(x,y) xor(x,y) == %bitxor(x,y) x < y == %ilt(x,y) diff --git a/src/algebra/string.spad.pamphlet b/src/algebra/string.spad.pamphlet index 16d128be..cdd1d97d 100644 --- a/src/algebra/string.spad.pamphlet +++ b/src/algebra/string.spad.pamphlet @@ -217,10 +217,10 @@ CharacterClass: Join(SetCategory, ConvertibleTo String, a = b == a =$Rep b member?(c, a) == a(ord c) - union(a,b) == Or(a, b) - intersect (a,b) == And(a, b) - difference(a,b) == And(a, Not b) - complement a == Not a + union(a,b) == a \/ b + intersect (a,b) == a /\ b + difference(a,b) == a /\ (~b) + complement a == ~a convert(cl):String == construct(convert(cl)@List(Character)) |