diff --git a/changelog b/changelog index 41f4ab7..187f1c4 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,4 @@ +20080829 tpd src/algebra/aggcat.spad graphviz dotfile decoration 20080828 mxr src/interp/i-funsel.boot add cost to bottomUp output 20080827 wsp src/algebra/tex.spad change \over to \frac 20080824 tpd src/input/Makefile add liu.input to regression diff --git a/src/algebra/aggcat.spad.pamphlet b/src/algebra/aggcat.spad.pamphlet index ee39ddd..7212a34 100644 --- a/src/algebra/aggcat.spad.pamphlet +++ b/src/algebra/aggcat.spad.pamphlet @@ -1,4 +1,3 @@ - \documentclass{article} \usepackage{axiom} \begin{document} @@ -11,8 +10,11 @@ \tableofcontents \eject \section{category AGG Aggregate} +<>= +"AGG" -> "TYPE" +"Aggregate()" -> "Type()" +@ <>= - )abbrev category AGG Aggregate ++ Author: Michael Monagan; revised by Manuel Bronstein and Richard Jenks ++ Date Created: August 87 through August 88 @@ -66,6 +68,10 @@ Aggregate: Category == Type with @ \section{category HOAGG HomogeneousAggregate} +<>= +"HOAGG" -> "AGG" +"HomogeneousAggregate(a:Type)" -> "Aggregate()" +@ <>= )abbrev category HOAGG HomogeneousAggregate ++ Author: Michael Monagan; revised by Manuel Bronstein and Richard Jenks @@ -272,6 +278,11 @@ Note that this code is not included in the generated catdef.spad file. (MAKEPROP (QUOTE |HomogeneousAggregate&|) (QUOTE |infovec|) (LIST (QUOTE #(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|local| |#2|) (|List| 37) (0 . |eval|) (|Mapping| 7 7) (6 . |map|) (12 . |eval|) (|List| 7) (18 . |parts|) (|NonNegativeInteger|) (23 . |#|) (|Boolean|) (|Mapping| 17 7) (28 . |any?|) (34 . |every?|) (40 . |count|) (46 . |members|) (51 . |=|) (57 . |count|) (63 . |count|) (69 . |any?|) (75 . |member?|) (81 . |#|) (86 . |size?|) (92 . |=|) (|OutputForm|) (98 . |coerce|) (|List| |$|) (103 . |commaSeparate|) (108 . |bracket|) (113 . |coerce|) (|Equation| 7))) (QUOTE #(|members| 118 |member?| 123 |every?| 129 |eval| 135 |count| 141 |coerce| 153 |any?| 158 |=| 164 |#| 170)) (QUOTE NIL) (CONS (|makeByteWordVec2| 1 (QUOTE NIL)) (CONS (QUOTE #()) (CONS (QUOTE #()) (|makeByteWordVec2| 36 (QUOTE (2 7 0 0 8 9 2 6 0 10 0 11 2 0 0 0 8 12 1 6 13 0 14 1 0 15 0 16 2 0 17 18 0 19 2 0 17 18 0 20 2 0 15 18 0 21 1 0 13 0 22 2 7 17 0 0 23 2 6 15 18 0 24 2 0 15 7 0 25 2 6 17 18 0 26 2 0 17 7 0 27 1 6 15 0 28 2 6 17 0 15 29 2 0 17 0 0 30 1 7 31 0 32 1 31 0 33 34 1 31 0 0 35 1 0 31 0 36 1 0 13 0 22 2 0 17 7 0 27 2 0 17 18 0 20 2 0 0 0 8 12 2 0 15 7 0 25 2 0 15 18 0 21 1 0 31 0 36 2 0 17 18 0 19 2 0 17 0 0 30 1 0 15 0 16)))))) (QUOTE |lookupComplete|))) @ \section{category CLAGG Collection} +<>= +"CLAGG" -> "HOAGG" +"Collection(a:Type)" -> "HomogeneousAggregate(a:Type)" +"Collection(a:SetCategory)" -> "Collection(a:Type)" +@ <>= )abbrev category CLAGG Collection ++ Author: Michael Monagan; revised by Manuel Bronstein and Richard Jenks @@ -420,6 +431,11 @@ Note that this code is not included in the generated catdef.spad file. (MAKEPROP (QUOTE |Collection&|) (QUOTE |infovec|) (LIST (QUOTE #(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|local| |#2|) (|List| 7) (0 . |parts|) (|NonNegativeInteger|) (5 . |#|) (|Mapping| 14 7) (10 . |count|) (|Boolean|) (16 . |any?|) (22 . |every?|) (|Union| 7 (QUOTE "failed")) (28 . |find|) (34 . |find|) (|Mapping| 7 7 7) (40 . |reduce|) (46 . |reduce|) (52 . |reduce|) (59 . |reduce|) (66 . |remove|) (72 . |construct|) (77 . |remove|) (83 . |select|) (89 . |select|) (95 . |=|) (101 . |remove|) (107 . |remove|) (113 . |reduce|) (121 . |reduce|) (129 . |removeDuplicates|) (134 . |removeDuplicates|))) (QUOTE #(|select| 139 |removeDuplicates| 145 |remove| 150 |reduce| 162 |find| 183 |every?| 189 |count| 195 |any?| 201 |#| 207)) (QUOTE NIL) (CONS (|makeByteWordVec2| 1 (QUOTE NIL)) (CONS (QUOTE #()) (CONS (QUOTE #()) (|makeByteWordVec2| 36 (QUOTE (1 6 8 0 9 1 0 10 0 11 2 0 10 12 0 13 2 0 14 12 0 15 2 0 14 12 0 16 2 8 17 12 0 18 2 0 17 12 0 19 2 8 7 20 0 21 2 0 7 20 0 22 3 8 7 20 0 7 23 3 0 7 20 0 7 24 2 8 0 12 0 25 1 6 0 8 26 2 0 0 12 0 27 2 8 0 12 0 28 2 0 0 12 0 29 2 7 14 0 0 30 2 6 0 12 0 31 2 0 0 7 0 32 4 8 7 20 0 7 7 33 4 0 7 20 0 7 7 34 1 8 0 0 35 1 0 0 0 36 2 0 0 12 0 29 1 0 0 0 36 2 0 0 7 0 32 2 0 0 12 0 27 4 0 7 20 0 7 7 34 3 0 7 20 0 7 24 2 0 7 20 0 22 2 0 17 12 0 19 2 0 14 12 0 16 2 0 10 12 0 13 2 0 14 12 0 15 1 0 10 0 11)))))) (QUOTE |lookupComplete|))) @ \section{category BGAGG BagAggregate} +<>= +"BGAGG" -> "HOAGG" +"BagAggregate(a:Type)" -> "HomogeneousAggregate(a:Type)" +"BagAggregate(a:SetCategory)" -> "BagAggregate(a:Type)" +@ <>= )abbrev category BGAGG BagAggregate ++ Author: Michael Monagan; revised by Manuel Bronstein and Richard Jenks @@ -455,6 +471,11 @@ BagAggregate(S:Type): Category == HomogeneousAggregate S with @ \section{category SKAGG StackAggregate} +<>= +"SKAGG" -> "BGAGG" +"StackAggregate(a:Type)" -> "BagAggregate(a:Type)" +"StackAggregate(a:SetCategory)" -> "StackAggregate(a:Type)" +@ <>= )abbrev category SKAGG StackAggregate ++ Author: Michael Monagan; revised by Manuel Bronstein and Richard Jenks @@ -488,6 +509,11 @@ StackAggregate(S:Type): Category == BagAggregate S with @ \section{category QUAGG QueueAggregate} +<>= +"QUAGG" -> "BGAGG" +"QueueAggregate(a:Type)" -> "BagAggregate(a:Type)" +"QueueAggregate(a:SetCategory)" -> "QueueAggregate(a:Type)" +@ <>= )abbrev category QUAGG QueueAggregate ++ Author: Michael Monagan; revised by Manuel Bronstein and Richard Jenks @@ -527,6 +553,13 @@ QueueAggregate(S:Type): Category == BagAggregate S with @ \section{category DQAGG DequeueAggregate} +<>= +"DQAGG" -> "SKAGG" +"DequeueAggregate(a:Type)" -> "StackAggregate(a:Type)" +"DQAGG" -> "QUAGG" +"DequeueAggregate(a:Type)" -> "QueueAggregate(a:Type)" +"DequeueAggregate(a:SetCategory)" -> "DequeueAggregate(a:Type)" +@ <>= )abbrev category DQAGG DequeueAggregate ++ Author: Michael Monagan; revised by Manuel Bronstein and Richard Jenks @@ -578,6 +611,13 @@ DequeueAggregate(S:Type): @ \section{category PRQAGG PriorityQueueAggregate} +<>= +"PRQAGG" -> "BGAGG" +"PriorityQueueAggregate(a:Type)" -> "BagAggregate(a:Type)" +"PriorityQueueAggregate(a:SetCategory)" -> "PriorityQueueAggregate(a:Type)" +"PriorityQueueAggregate(a:OrderedSet)" -> + "PriorityQueueAggregate(a:SetCategory)" +@ <>= )abbrev category PRQAGG PriorityQueueAggregate ++ Author: Michael Monagan; revised by Manuel Bronstein and Richard Jenks @@ -605,6 +645,12 @@ PriorityQueueAggregate(S:OrderedSet): Category == BagAggregate S with @ \section{category DIOPS DictionaryOperations} +<>= +"DIOPS" -> "BGAGG" +"DictionaryOperations(a:SetCategory)" -> "BagAggregate(a:SetCategory)" +"DIOPS" -> "CLAGG" +"DictionaryOperations(a:SetCategory)" -> "Collection(a:SetCategory)" +@ <>= )abbrev category DIOPS DictionaryOperations ++ Author: Michael Monagan; revised by Manuel Bronstein and Richard Jenks @@ -655,6 +701,12 @@ DictionaryOperations(S:SetCategory): Category == @ \section{category DIAGG Dictionary} +<>= +"DIAGG" -> "DIOPS" +"Dictionary(a:SetCategory)" -> "DictionaryOperations(a:SetCategory)" +"Dictionary(Record(a:SetCategory,b:SetCategory)" -> + "Dictionary(a:SetCategory)" +@ <>= )abbrev category DIAGG Dictionary ++ Author: Michael Monagan; revised by Manuel Bronstein and Richard Jenks @@ -700,6 +752,10 @@ Dictionary(S:SetCategory): Category == @ \section{category MDAGG MultiDictionary} +<>= +"MDAGG" -> "DIOPS" +"MultiDictionary(a:SetCategory)" -> "DictionaryOperations(a:SetCategory)" +@ <>= )abbrev category MDAGG MultiDictionary ++ Author: Michael Monagan; revised by Manuel Bronstein and Richard Jenks @@ -732,6 +788,12 @@ MultiDictionary(S:SetCategory): Category == DictionaryOperations S with @ \section{category SETAGG SetAggregate} +<>= +"SETAGG" -> "SETCAT" +"SetAggregate(a:SetCategory)" -> "SetCategory()" +"SETAGG" -> "CLAGG" +"SetAggregate(a:SetCategory)" -> "Collection(a:SetCategory)" +@ <>= )abbrev category SETAGG SetAggregate ++ Author: Michael Monagan; revised by Manuel Bronstein and Richard Jenks @@ -857,6 +919,12 @@ Note that this code is not included in the generated catdef.spad file. (MAKEPROP (QUOTE |SetAggregate&|) (QUOTE |infovec|) (LIST (QUOTE #(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|local| |#2|) (0 . |difference|) (6 . |union|) |SETAGG-;symmetricDifference;3A;1| (|List| 7) (12 . |brace|) |SETAGG-;union;ASA;2| |SETAGG-;union;S2A;3| |SETAGG-;difference;ASA;4|)) (QUOTE #(|union| 17 |symmetricDifference| 29 |difference| 35)) (QUOTE NIL) (CONS (|makeByteWordVec2| 1 (QUOTE NIL)) (CONS (QUOTE #()) (CONS (QUOTE #()) (|makeByteWordVec2| 15 (QUOTE (2 6 0 0 0 8 2 6 0 0 0 9 1 6 0 11 12 2 0 0 7 0 14 2 0 0 0 7 13 2 0 0 0 0 10 2 0 0 0 7 15)))))) (QUOTE |lookupComplete|))) @ \section{category FSAGG FiniteSetAggregate} +<>= +"FSAGG" -> "DIAGG" +"FiniteSetAggregate(a:SetCategory)" -> "Dictionary(a:SetCategory)" +"FSAGG" -> "SETAGG" +"FiniteSetAggregate(a:SetCategory)" -> "SetAggregate(a:SetCategory)" +@ <>= )abbrev category FSAGG FiniteSetAggregate ++ Author: Michael Monagan; revised by Manuel Bronstein and Richard Jenks @@ -949,6 +1017,12 @@ FiniteSetAggregate(S:SetCategory): Category == @ \section{category MSETAGG MultisetAggregate} +<>= +"MSETAGG" -> "MDAGG" +"MultisetAggregate(a:SetCategory)" -> "MultiDictionary(a:SetCategory)" +"MSETAGG" -> "SETAGG" +"MultisetAggregate(a:SetCategory)" -> "SetAggregate(a:SetCategory)" +@ <>= )abbrev category MSETAGG MultisetAggregate ++ Author: Michael Monagan; revised by Manuel Bronstein and Richard Jenks @@ -968,6 +1042,14 @@ MultisetAggregate(S:SetCategory): @ \section{category OMSAGG OrderedMultisetAggregate} +<>= +"OMSAGG" -> "MSETAGG" +"OrderedMultisetAggregate(a:SetCategory)" -> + "MultisetAggregate(a:SetCategory)" +"OMSAGG" -> "PRQAGG" +"OrderedMultisetAggregate(a:SetCategory)" -> + "PriorityQueueAggregate(a:SetCategory)" +@ <>= )abbrev category OMSAGG OrderedMultisetAggregate ++ Author: Michael Monagan; revised by Manuel Bronstein and Richard Jenks @@ -994,6 +1076,11 @@ OrderedMultisetAggregate(S:OrderedSet): Category == @ \section{category KDAGG KeyedDictionary} +<>= +"KDAGG" -> "DIAGG" +"KeyedDictionary(a:SetCategory,b:SetCategory)" -> + "Dictionary(Record(a:SetCategory,b:SetCategory)" +@ <>= )abbrev category KDAGG KeyedDictionary ++ Author: Michael Monagan; revised by Manuel Bronstein and Richard Jenks @@ -1035,6 +1122,10 @@ KeyedDictionary(Key:SetCategory, Entry:SetCategory): Category == @ \section{category ELTAB Eltable} +<>= +"ELTAB" -> "CATEGORY" +"Eltable(a:SetCategory,b:Type)" -> "Category" +@ <>= )abbrev category ELTAB Eltable ++ Author: Michael Monagan; revised by Manuel Bronstein and Manuel Bronstein @@ -1058,6 +1149,10 @@ Eltable(S:SetCategory, Index:Type): Category == with @ \section{category ELTAGG EltableAggregate} +<>= +"ELTAGG" -> "ELTAB" +"EltableAggregate(a:SetCategory,b:Type)"-> "Eltable(a:SetCategory,b:Type)" +@ <>= )abbrev category ELTAGG EltableAggregate ++ Author: Michael Monagan; revised by Manuel Bronstein and Richard Jenks @@ -1109,6 +1204,18 @@ EltableAggregate(Dom:SetCategory, Im:Type): Category == @ \section{category IXAGG IndexedAggregate} +<>= +"IXAGG" -> "HOAGG" +"IndexedAggregate(a:SetCategory,b:Type)" -> + "HomogeneousAggregate(a:Type)" +"IXAGG" -> "ELTAGG" +"IndexedAggregate(a:SetCategory,b:Type)" -> + "EltableAggregate(a:SetCategory,b:Type)" +"IndexedAggregate(a:SetCategory,b:SetCategory)" -> + "IndexedAggregate(a:SetCategory,b:Type)" +"IndexedAggregate(b:Integer,a:Type)" -> + "IndexedAggregate(a:SetCategory,b:Type)" +@ <>= )abbrev category IXAGG IndexedAggregate ++ Author: Michael Monagan; revised by Manuel Bronstein and Richard Jenks @@ -1198,6 +1305,14 @@ IndexedAggregate(Index: SetCategory, Entry: Type): Category == @ \section{category TBAGG TableAggregate} +<>= +"TBAGG" -> "KDAGG" +"TableAggregate(a:SetCategory,b:SetCategory)" -> + "KeyedDictionary(a:SetCategory,b:SetCategory)" +"TBAGG" -> "IXAGG" +"TableAggregate(a:SetCategory,b:SetCategory)" -> + "IndexedAggregate(a:SetCategory,b:SetCategory)" +@ <>= )abbrev category TBAGG TableAggregate ++ Author: Michael Monagan, Stephen Watt; revised by Manuel Bronstein and Richard Jenks @@ -1220,9 +1335,9 @@ TableAggregate(Key:SetCategory, Entry:SetCategory): Category == table: () -> % ++ table()$T creates an empty table of type T. ++ - ++X Data:=Record(age:Integer,gender:String) - ++X a1:AssociationList(String,Data):=table() - ++X a1."tim":=[55,"male"]$Data + ++E Data:=Record(age:Integer,gender:String) + ++E a1:AssociationList(String,Data):=table() + ++E a1."tim":=[55,"male"]$Data table: List Record(key:Key,entry:Entry) -> % ++ table([x,y,...,z]) creates a table consisting of entries @@ -1326,6 +1441,10 @@ TableAggregate(Key:SetCategory, Entry:SetCategory): Category == @ \section{category RCAGG RecursiveAggregate} +<>= +"RCAGG" -> "HOAGG" +"RecursiveAggregate(a:Type)" -> "HomogeneousAggregate(a:Type)" +@ <>= )abbrev category RCAGG RecursiveAggregate ++ Author: Michael Monagan; revised by Manuel Bronstein and Richard Jenks @@ -1435,6 +1554,10 @@ Note that this code is not included in the generated catdef.spad file. (MAKEPROP (QUOTE |RecursiveAggregate&|) (QUOTE |infovec|) (LIST (QUOTE #(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|local| |#2|) (0 . |value|) (QUOTE "value") |RCAGG-;elt;AvalueS;1| (5 . |setvalue!|) (11 . |setelt|) (|List| |$|) (18 . |children|) (|Boolean|) (|List| 6) (23 . |member?|) (29 . |child?|))) (QUOTE #(|setelt| 35 |elt| 42 |child?| 48)) (QUOTE NIL) (CONS (|makeByteWordVec2| 1 (QUOTE NIL)) (CONS (QUOTE #()) (CONS (QUOTE #()) (|makeByteWordVec2| 18 (QUOTE (1 6 7 0 8 2 6 7 0 7 11 3 0 7 0 9 7 12 1 6 13 0 14 2 16 15 6 0 17 2 0 15 0 0 18 3 0 7 0 9 7 12 2 0 7 0 9 10 2 0 15 0 0 18)))))) (QUOTE |lookupComplete|))) @ \section{category BRAGG BinaryRecursiveAggregate} +<>= +"BRAGG" -> "RCAGG" +"BinaryRecursiveAggregate(a:Type)" -> "RecursiveAggregate(a:Type)" +@ <>= )abbrev category BRAGG BinaryRecursiveAggregate ++ Author: Michael Monagan; revised by Manuel Bronstein and Richard Jenks @@ -1550,6 +1673,10 @@ BinaryRecursiveAggregate(S:Type):Category == RecursiveAggregate S with @ \section{category DLAGG DoublyLinkedAggregate} +<>= +"DLAGG" -> "RCAGG" +"DoublyLinkedAggregate(a:Type)" -> "RecursiveAggregate(a:Type)" +@ <>= )abbrev category DLAGG DoublyLinkedAggregate ++ Author: Michael Monagan; revised by Manuel Bronstein and Richard Jenks @@ -1596,6 +1723,10 @@ DoublyLinkedAggregate(S:Type): Category == RecursiveAggregate S with @ \section{category URAGG UnaryRecursiveAggregate} +<>= +"URAGG" -> "RCAGG" +"UnaryRecursiveAggregate(a:Type)" -> "RecursiveAggregate(a:Type)" +@ <>= )abbrev category URAGG UnaryRecursiveAggregate ++ Author: Michael Monagan; revised by Manuel Bronstein and Richard Jenks @@ -1619,196 +1750,90 @@ DoublyLinkedAggregate(S:Type): Category == RecursiveAggregate S with ++ Since these aggregates are recursive aggregates, they may be cyclic. UnaryRecursiveAggregate(S:Type): Category == RecursiveAggregate S with concat: (%,%) -> % - ++ concat(u,v) returns an aggregate w consisting of the elements of u - ++ followed by the elements of v. - ++ Note: \axiom{v = rest(w,#a)}. - ++ - ++X m:=[1,2,3] - ++X concat(5,m) - + ++ concat(u,v) returns an aggregate w consisting of the elements of u + ++ followed by the elements of v. + ++ Note: \axiom{v = rest(w,#a)}. concat: (S,%) -> % - ++ concat(x,u) returns aggregate consisting of x followed by - ++ the elements of u. - ++ Note: if \axiom{v = concat(x,u)} then \axiom{x = first v} - ++ and \axiom{u = rest v}. - ++ - ++X m:=[1,2,3] - ++X concat(m,m) - + ++ concat(x,u) returns aggregate consisting of x followed by + ++ the elements of u. + ++ Note: if \axiom{v = concat(x,u)} then \axiom{x = first v} + ++ and \axiom{u = rest v}. first: % -> S - ++ first(u) returns the first element of u - ++ (equivalently, the value at the current node). - ++ - ++X m:=[1,2,3] - ++X first(m) - + ++ first(u) returns the first element of u + ++ (equivalently, the value at the current node). elt: (%,"first") -> S - ++ elt(u,"first") (also written: \axiom{u . first}) is - ++equivalent to first u. - + ++ elt(u,"first") (also written: \axiom{u . first}) is equivalent to first u. first: (%,NonNegativeInteger) -> % - ++ first(u,n) returns a copy of the first n - ++ (\axiom{n >= 0}) elements of u. - ++ - ++X m:=[1,2,3] - ++X first(m,2) - + ++ first(u,n) returns a copy of the first n (\axiom{n >= 0}) elements of u. rest: % -> % - ++ rest(u) returns an aggregate consisting of all but the first - ++ element of u - ++ (equivalently, the next node of u). - ++ - ++X m:=[1,2,3] - ++X rest m - + ++ rest(u) returns an aggregate consisting of all but the first + ++ element of u + ++ (equivalently, the next node of u). elt: (%,"rest") -> % - ++ elt(%,"rest") (also written: \axiom{u.rest}) is - ++ equivalent to \axiom{rest u}. - + ++ elt(%,"rest") (also written: \axiom{u.rest}) is + ++ equivalent to \axiom{rest u}. rest: (%,NonNegativeInteger) -> % - ++ rest(u,n) returns the \axiom{n}th (n >= 0) node of u. - ++ Note: \axiom{rest(u,0) = u}. - ++ - ++X m:=[1,2,3] - ++X rest(m,2) - + ++ rest(u,n) returns the \axiom{n}th (n >= 0) node of u. + ++ Note: \axiom{rest(u,0) = u}. last: % -> S - ++ last(u) resturn the last element of u. - ++ Note: for lists, \axiom{last(u) = u . (maxIndex u) = u . (# u - 1)}. - ++ - ++X m:=[1,2,3] - ++X last m - + ++ last(u) resturn the last element of u. + ++ Note: for lists, \axiom{last(u) = u . (maxIndex u) = u . (# u - 1)}. elt: (%,"last") -> S - ++ elt(u,"last") (also written: \axiom{u . last}) is equivalent to last u. - + ++ elt(u,"last") (also written: \axiom{u . last}) is equivalent to last u. last: (%,NonNegativeInteger) -> % - ++ last(u,n) returns a copy of the last n (\axiom{n >= 0}) nodes of u. - ++ Note: \axiom{last(u,n)} is a list of n elements. - ++ - ++X m:=[1,2,3] - ++X last(m,2) - + ++ last(u,n) returns a copy of the last n (\axiom{n >= 0}) nodes of u. + ++ Note: \axiom{last(u,n)} is a list of n elements. tail: % -> % - ++ tail(u) returns the last node of u. - ++ Note: if u is \axiom{shallowlyMutable}, - ++ \axiom{setrest(tail(u),v) = concat(u,v)}. - ++ - ++X m:=[1,2,3] - ++X last(m,2) - + ++ tail(u) returns the last node of u. + ++ Note: if u is \axiom{shallowlyMutable}, + ++ \axiom{setrest(tail(u),v) = concat(u,v)}. second: % -> S - ++ second(u) returns the second element of u. - ++ Note: \axiom{second(u) = first(rest(u))}. - ++ - ++X m:=[1,2,3] - ++X second m - + ++ second(u) returns the second element of u. + ++ Note: \axiom{second(u) = first(rest(u))}. third: % -> S - ++ third(u) returns the third element of u. - ++ Note: \axiom{third(u) = first(rest(rest(u)))}. - ++ - ++X m:=[1,2,3] - ++X third m - + ++ third(u) returns the third element of u. + ++ Note: \axiom{third(u) = first(rest(rest(u)))}. cycleEntry: % -> % - ++ cycleEntry(u) returns the head of a top-level cycle contained in - ++ aggregate u, or \axiom{empty()} if none exists. - ++ - ++X m:=[1,2,3] - ++X concat!(m,tail(m)) - ++X cycleEntry m - + ++ cycleEntry(u) returns the head of a top-level cycle contained in + ++ aggregate u, or \axiom{empty()} if none exists. cycleLength: % -> NonNegativeInteger - ++ cycleLength(u) returns the length of a top-level cycle - ++ contained in aggregate u, or 0 is u has no such cycle. - ++ - ++X m:=[1,2,3] - ++X concat!(m,tail(m)) - ++X cycleLength m - + ++ cycleLength(u) returns the length of a top-level cycle + ++ contained in aggregate u, or 0 is u has no such cycle. cycleTail: % -> % - ++ cycleTail(u) returns the last node in the cycle, or - ++ empty if none exists. - ++ - ++X m:=[1,2,3] - ++X concat!(m,tail(m)) - ++X cycleTail m - + ++ cycleTail(u) returns the last node in the cycle, or + ++ empty if none exists. if % has shallowlyMutable then concat_!: (%,%) -> % ++ concat!(u,v) destructively concatenates v to the end of u. ++ Note: \axiom{concat!(u,v) = setlast_!(u,v)}. - ++ - ++X m:=[1,2,3] - ++X n:=[4,5,6] - ++X concat!(m,n) - concat_!: (%,S) -> % ++ concat!(u,x) destructively adds element x to the end of u. ++ Note: \axiom{concat!(a,x) = setlast!(a,[x])}. - ++ - ++X m:=[1,2,3] - ++X concat!(m,5) - cycleSplit_!: % -> % ++ cycleSplit!(u) splits the aggregate by dropping off the cycle. ++ The value returned is the cycle entry, or nil if none exists. - ++ If \axiom{w = concat(u,v)} is the cyclic list where v is + ++ For example, if \axiom{w = concat(u,v)} is the cyclic list where v is ++ the head of the cycle, \axiom{cycleSplit!(w)} will drop v off w thus ++ destructively changing w to u, and returning v. - ++ - ++X m:=[1,2,3] - ++X concat!(m,m) - ++X n:=[4,5,6] - ++X p:=concat(n,m) - ++X q:=cycleSplit! p - ++X p - ++X q - setfirst_!: (%,S) -> S ++ setfirst!(u,x) destructively changes the first element of a to x. - ++ - ++X m:=[1,2,3] - ++X setfirst!(m,4) - ++X m - setelt: (%,"first",S) -> S ++ setelt(u,"first",x) (also written: \axiom{u.first := x}) is ++ equivalent to \axiom{setfirst!(u,x)}. - setrest_!: (%,%) -> % ++ setrest!(u,v) destructively changes the rest of u to v. - ++ - ++X m:=[1,2,3] - ++X setrest!(m,[4,5,6]) - ++X m - setelt: (%,"rest",%) -> % - ++ setelt(u,"rest",v) (also written: \axiom{u.rest := v}) - ++ is equivalent to \axiom{setrest!(u,v)}. - + ++ setelt(u,"rest",v) (also written: \axiom{u.rest := v}) is equivalent to + ++ \axiom{setrest!(u,v)}. setlast_!: (%,S) -> S ++ setlast!(u,x) destructively changes the last element of u to x. - ++ - ++X m:=[1,2,3] - ++X setlast!(m,4) - ++X m - setelt: (%,"last",S) -> S ++ setelt(u,"last",x) (also written: \axiom{u.last := b}) ++ is equivalent to \axiom{setlast!(u,v)}. - split_!: (%,Integer) -> % - ++ split!(u,n) splits u into two aggregates: \axiom{v = rest(u,n)} - ++ and \axiom{w = first(u,n)}, returning \axiom{v}. - ++ Note: afterwards \axiom{rest(u,n)} returns \axiom{empty()}. - ++ - ++X m:=[1,2,3,4] - ++X n:=split!(m,2) - ++X m - ++X n - + ++ split!(u,n) splits u into two aggregates: \axiom{v = rest(u,n)} + ++ and \axiom{w = first(u,n)}, returning \axiom{v}. + ++ Note: afterwards \axiom{rest(u,n)} returns \axiom{empty()}. add cycleMax ==> 1000 @@ -2068,6 +2093,12 @@ Note that this code is not included in the generated catdef.spad file. (MAKEPROP (QUOTE |UnaryRecursiveAggregate&|) (QUOTE |infovec|) (LIST (QUOTE #(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|local| |#2|) (0 . |first|) (QUOTE "first") |URAGG-;elt;AfirstS;1| (5 . |last|) (QUOTE "last") |URAGG-;elt;AlastS;2| (10 . |rest|) (QUOTE "rest") |URAGG-;elt;ArestA;3| |URAGG-;second;AS;4| |URAGG-;third;AS;5| (|Boolean|) (15 . |empty?|) |URAGG-;cyclic?;AB;6| (20 . |tail|) |URAGG-;last;AS;7| (|List| |$|) |URAGG-;nodes;AL;8| |URAGG-;children;AL;9| |URAGG-;leaf?;AB;10| |URAGG-;value;AS;11| (|NonNegativeInteger|) |URAGG-;less?;ANniB;12| |URAGG-;more?;ANniB;13| |URAGG-;size?;ANniB;14| (25 . |cyclic?|) |URAGG-;#;ANni;15| |URAGG-;tail;2A;16| (30 . |eq?|) (36 . |cycleEntry|) |URAGG-;cycleTail;2A;18| |URAGG-;cycleEntry;2A;19| |URAGG-;cycleLength;ANni;20| |URAGG-;rest;ANniA;21| (41 . |#|) (46 . |rest|) (52 . |copy|) (57 . |last|) (63 . |=|) (69 . |=|) (75 . |=|) (81 . |node?|) (87 . |setfirst!|) (93 . |setelt|) (100 . |setlast!|) (106 . |setelt|) (113 . |setrest!|) (119 . |setelt|) (126 . |concat!|) (132 . |concat|) (138 . |setlast!|) (144 . |setchildren!|) (150 . |setvalue!|) (156 . |empty|) (|Integer|) (160 . |split!|) (166 . |cycleSplit!|) (QUOTE "value"))) (QUOTE #(|value| 171 |third| 176 |tail| 181 |split!| 186 |size?| 192 |setvalue!| 198 |setlast!| 204 |setelt| 210 |setchildren!| 231 |second| 237 |rest| 242 |nodes| 248 |node?| 253 |more?| 259 |less?| 265 |leaf?| 271 |last| 276 |elt| 287 |cyclic?| 305 |cycleTail| 310 |cycleSplit!| 315 |cycleLength| 320 |cycleEntry| 325 |concat| 330 |children| 336 |=| 341 |#| 347)) (QUOTE NIL) (CONS (|makeByteWordVec2| 1 (QUOTE NIL)) (CONS (QUOTE #()) (CONS (QUOTE #()) (|makeByteWordVec2| 64 (QUOTE (1 6 7 0 8 1 6 7 0 11 1 6 0 0 14 1 6 19 0 20 1 6 0 0 22 1 6 19 0 33 2 6 19 0 0 36 1 6 0 0 37 1 6 29 0 42 2 6 0 0 29 43 1 6 0 0 44 2 0 0 0 29 45 2 7 19 0 0 46 2 0 19 0 0 47 2 6 19 0 0 48 2 0 19 0 0 49 2 6 7 0 7 50 3 0 7 0 9 7 51 2 6 7 0 7 52 3 0 7 0 12 7 53 2 6 0 0 0 54 3 0 0 0 15 0 55 2 6 0 0 0 56 2 0 0 0 0 57 2 0 7 0 7 58 2 0 0 0 24 59 2 0 7 0 7 60 0 6 0 61 2 0 0 0 62 63 1 0 0 0 64 1 0 7 0 28 1 0 7 0 18 1 0 0 0 35 2 0 0 0 62 63 2 0 19 0 29 32 2 0 7 0 7 60 2 0 7 0 7 58 3 0 7 0 12 7 53 3 0 0 0 15 0 55 3 0 7 0 9 7 51 2 0 0 0 24 59 1 0 7 0 17 2 0 0 0 29 41 1 0 24 0 25 2 0 19 0 0 49 2 0 19 0 29 31 2 0 19 0 29 30 1 0 19 0 27 2 0 0 0 29 45 1 0 7 0 23 2 0 7 0 12 13 2 0 0 0 15 16 2 0 7 0 9 10 1 0 19 0 21 1 0 0 0 38 1 0 0 0 64 1 0 29 0 40 1 0 0 0 39 2 0 0 0 0 57 1 0 24 0 26 2 0 19 0 0 47 1 0 29 0 34)))))) (QUOTE |lookupComplete|))) @ \section{category STAGG StreamAggregate} +<>= +"STAGG" -> "RCAGG" +"StreamAggregate(a:Type)" -> "RecursiveAggregate(a:Type)" +"STAGG" -> "LNAGG" +"StreamAggregate(a:Type)" -> "LinearAggregate(a:Type)" +@ <>= )abbrev category STAGG StreamAggregate ++ Author: Michael Monagan; revised by Manuel Bronstein and Richard Jenks @@ -2223,6 +2254,12 @@ Note that this code is not included in the generated catdef.spad file. (MAKEPROP (QUOTE |StreamAggregate&|) (QUOTE |infovec|) (LIST (QUOTE #(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|local| |#2|) (|Boolean|) (0 . |cyclic?|) |STAGG-;explicitlyFinite?;AB;1| |STAGG-;possiblyInfinite?;AB;2| (5 . |rest|) (|List| 7) (10 . |construct|) (|NonNegativeInteger|) |STAGG-;first;ANniA;3| (15 . |empty?|) (20 . |first|) (|Integer|) (25 . |minIndex|) (30 . |rest|) |STAGG-;elt;AIS;5| (|UniversalSegment| 19) (36 . |lo|) (41 . |hasHi|) (46 . |copy|) (51 . |hi|) (56 . |empty|) (60 . |first|) |STAGG-;elt;AUsA;6| (66 . |concat!|) (72 . |concat|) (|List| |$|) (78 . |concat|) (83 . |concat|) (88 . |setfirst!|) (|Mapping| 7 7) (94 . |map!|) (100 . |fill!|) (106 . |setelt|) (113 . |maxIndex|) (118 . |eq?|) (124 . |setelt|) (131 . |tail|) (136 . |setrest!|) (142 . |concat!|) (QUOTE "rest") (QUOTE "last") (QUOTE "first") (QUOTE "value"))) (QUOTE #(|setelt| 148 |possiblyInfinite?| 162 |map!| 167 |first| 173 |fill!| 179 |explicitlyFinite?| 185 |elt| 190 |concat!| 202 |concat| 208)) (QUOTE NIL) (CONS (|makeByteWordVec2| 1 (QUOTE NIL)) (CONS (QUOTE #()) (CONS (QUOTE #()) (|makeByteWordVec2| 46 (QUOTE (1 6 8 0 9 1 6 0 0 12 1 6 0 13 14 1 6 8 0 17 1 6 7 0 18 1 6 19 0 20 2 6 0 0 15 21 1 23 19 0 24 1 23 8 0 25 1 6 0 0 26 1 23 19 0 27 0 6 0 28 2 6 0 0 15 29 2 6 0 0 0 31 2 0 0 0 0 32 1 6 0 33 34 1 0 0 33 35 2 6 7 0 7 36 2 0 0 37 0 38 2 0 0 0 7 39 3 0 7 0 19 7 40 1 6 19 0 41 2 6 8 0 0 42 3 0 7 0 23 7 43 1 6 0 0 44 2 6 0 0 0 45 2 0 0 0 0 46 3 0 7 0 19 7 40 3 0 7 0 23 7 43 1 0 8 0 11 2 0 0 37 0 38 2 0 0 0 15 16 2 0 0 0 7 39 1 0 8 0 10 2 0 7 0 19 22 2 0 0 0 23 30 2 0 0 0 0 46 1 0 0 33 35 2 0 0 0 0 32)))))) (QUOTE |lookupComplete|))) @ \section{category LNAGG LinearAggregate} +<>= +"LNAGG" -> "IXAGG" +"LinearAggregate(a:Type)" -> "IndexedAggregate(b:Integer,a:Type)" +"LNAGG" -> "CLAGG" +"LinearAggregate(a:Type)" -> "Collection(a:Type)" +@ <>= )abbrev category LNAGG LinearAggregate ++ Author: Michael Monagan; revised by Manuel Bronstein and Richard Jenks @@ -2358,6 +2395,10 @@ Note that this code is not included in the generated catdef.spad file. (MAKEPROP (QUOTE |LinearAggregate&|) (QUOTE |infovec|) (LIST (QUOTE #(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|local| |#2|) (|Integer|) (0 . |minIndex|) (5 . |maxIndex|) (|List| 8) |LNAGG-;indices;AL;1| (|Boolean|) |LNAGG-;index?;IAB;2| (|NonNegativeInteger|) (10 . |new|) (16 . |concat|) |LNAGG-;concat;ASA;3| |LNAGG-;concat;S2A;4| (22 . |insert|) |LNAGG-;insert;SAIA;5| (29 . |#|) (34 . |maxIndex|) (|List| |$|))) (QUOTE #(|maxIndex| 39 |insert| 44 |indices| 51 |index?| 56 |concat| 62)) (QUOTE NIL) (CONS (|makeByteWordVec2| 1 (QUOTE NIL)) (CONS (QUOTE #()) (CONS (QUOTE #()) (|makeByteWordVec2| 23 (QUOTE (1 6 8 0 9 1 6 8 0 10 2 6 0 15 7 16 2 6 0 0 0 17 3 6 0 0 0 8 20 1 6 15 0 22 1 0 8 0 23 1 0 8 0 23 3 0 0 7 0 8 21 1 0 11 0 12 2 0 13 8 0 14 2 0 0 0 7 18 2 0 0 7 0 19)))))) (QUOTE |lookupComplete|))) @ \section{category FLAGG FiniteLinearAggregate} +<>= +"FLAGG" -> "LNAGG" +"FiniteLinearAggregate(a:Type)" -> "LinearAggregate(a:Type)" +@ <>= )abbrev category FLAGG FiniteLinearAggregate ++ Author: Michael Monagan; revised by Manuel Bronstein and Richard Jenks @@ -2441,6 +2482,15 @@ FiniteLinearAggregate(S:Type): Category == LinearAggregate S with @ \section{category A1AGG OneDimensionalArrayAggregate} +<>= +"A1AGG" -> "FLAGG" +"OneDimensionalArrayAggregate(a:Type)" -> + "FiniteLinearAggregate(a:Type)" +"OneDimensionalArrayAggregate(Character)" -> + "OneDimensionalArrayAggregate(a:Type)" +"OneDimensionalArrayAggregate(Boolean)" -> + "OneDimensionalArrayAggregate(a:Type)" +@ <>= )abbrev category A1AGG OneDimensionalArrayAggregate ++ Author: Michael Monagan; revised by Manuel Bronstein and Richard Jenks @@ -2689,6 +2739,10 @@ OneDimensionalArrayAggregate(S:Type): Category == @ \section{category ELAGG ExtensibleLinearAggregate} +<>= +"ELAGG" -> "LNAGG" +"ExtensibleLinearAggregate(a:Type)" -> "LinearAggregate(a:Type)" +@ <>= )abbrev category ELAGG ExtensibleLinearAggregate ++ Author: Michael Monagan; revised by Manuel Bronstein and Richard Jenks @@ -2717,10 +2771,10 @@ ExtensibleLinearAggregate(S:Type):Category == LinearAggregate S with delete_!: (%,Integer) -> % ++ delete!(u,i) destructively deletes the \axiom{i}th element of u. ++ - ++X Data:=Record(age:Integer,gender:String) - ++X a1:AssociationList(String,Data):=table() - ++X a1."tim":=[55,"male"]$Data - ++X delete!(a1,1) + ++E Data:=Record(age:Integer,gender:String) + ++E a1:AssociationList(String,Data):=table() + ++E a1."tim":=[55,"male"]$Data + ++E delete!(a1,1) delete_!: (%,UniversalSegment(Integer)) -> % ++ delete!(u,i..j) destructively deletes elements u.i through u.j. @@ -2763,6 +2817,12 @@ ExtensibleLinearAggregate(S:Type):Category == LinearAggregate S with @ \section{category LSAGG ListAggregate} +<>= +"LSAGG" -> "FLAGG" +"ListAggregate(a:Type)" -> "FiniteLinearAggregate(a:Type)" +"LSAGG" -> "ELAGG" +"ListAggregate(a:Type)" -> "ExtensibleLinearAggregate(a:Type)" +@ <>= )abbrev category LSAGG ListAggregate ++ Author: Michael Monagan; revised by Manuel Bronstein and Richard Jenks @@ -3073,6 +3133,14 @@ Note that this code is not included in the generated catdef.spad file. (MAKEPROP (QUOTE |ListAggregate&|) (QUOTE |infovec|) (LIST (QUOTE #(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|local| |#2|) (|NonNegativeInteger|) (0 . |#|) (|Mapping| 15 7 7) |LSAGG-;sort!;M2A;1| (5 . |empty|) (9 . |concat|) |LSAGG-;list;SA;2| (|Boolean|) (15 . |empty?|) (20 . |rest|) (25 . |first|) (|Mapping| 7 7 7) (30 . |reduce|) |LSAGG-;reduce;MAS;3| (37 . |copy|) (42 . |merge!|) |LSAGG-;merge;M3A;4| (49 . |setrest!|) (|Mapping| 15 7) |LSAGG-;select!;M2A;5| (55 . |eq?|) |LSAGG-;merge!;M3A;6| (|Integer|) (61 . |minIndex|) (66 . |rest|) |LSAGG-;insert!;SAIA;7| (72 . |concat!|) |LSAGG-;insert!;2AIA;8| |LSAGG-;remove!;M2A;9| |LSAGG-;delete!;AIA;10| (|UniversalSegment| 30) (78 . |lo|) (83 . |hasHi|) (88 . |hi|) (93 . |maxIndex|) |LSAGG-;delete!;AUsA;11| (|Union| 7 (QUOTE "failed")) |LSAGG-;find;MAU;12| |LSAGG-;position;MAI;13| (98 . |reverse!|) (103 . |split!|) |LSAGG-;sorted?;MAB;15| |LSAGG-;reduce;MA2S;16| (109 . |=|) (115 . |reduce|) |LSAGG-;new;NniSA;18| |LSAGG-;map;M3A;19| |LSAGG-;reverse!;2A;20| (123 . |cyclic?|) |LSAGG-;copy;2A;21| (128 . |setfirst!|) |LSAGG-;copyInto!;2AIA;22| (134 . |position|) (141 . |remove!|) (147 . |removeDuplicates!|) (152 . |<|) (158 . |<|) (|Mapping| 7 7))) (QUOTE #(|sorted?| 164 |sort!| 170 |select!| 176 |reverse!| 182 |removeDuplicates!| 187 |remove!| 192 |reduce| 198 |position| 219 |new| 232 |merge!| 238 |merge| 245 |map| 252 |list| 259 |insert!| 264 |find| 278 |delete!| 284 |copyInto!| 296 |copy| 303 |<| 308)) (QUOTE NIL) (CONS (|makeByteWordVec2| 1 (QUOTE NIL)) (CONS (QUOTE #()) (CONS (QUOTE #()) (|makeByteWordVec2| 64 (QUOTE (1 6 8 0 9 0 6 0 12 2 6 0 7 0 13 1 6 15 0 16 1 6 0 0 17 1 6 7 0 18 3 6 7 19 0 7 20 1 6 0 0 22 3 6 0 10 0 0 23 2 6 0 0 0 25 2 6 15 0 0 28 1 6 30 0 31 2 6 0 0 8 32 2 6 0 0 0 34 1 38 30 0 39 1 38 15 0 40 1 38 30 0 41 1 6 30 0 42 1 6 0 0 47 2 6 0 0 30 48 2 7 15 0 0 51 4 0 7 19 0 7 7 52 1 6 15 0 56 2 6 7 0 7 58 3 0 30 7 0 30 60 2 6 0 26 0 61 1 0 0 0 62 2 7 15 0 0 63 2 0 15 0 0 64 2 0 15 10 0 49 2 0 0 10 0 11 2 0 0 26 0 27 1 0 0 0 55 1 0 0 0 62 2 0 0 26 0 36 3 0 7 19 0 7 50 4 0 7 19 0 7 7 52 2 0 7 19 0 21 2 0 30 26 0 46 3 0 30 7 0 30 60 2 0 0 8 7 53 3 0 0 10 0 0 29 3 0 0 10 0 0 24 3 0 0 19 0 0 54 1 0 0 7 14 3 0 0 7 0 30 33 3 0 0 0 0 30 35 2 0 44 26 0 45 2 0 0 0 38 43 2 0 0 0 30 37 3 0 0 0 0 30 59 1 0 0 0 57 2 0 15 0 0 64)))))) (QUOTE |lookupComplete|))) @ \section{category ALAGG AssociationListAggregate} +<>= +"ALAGG" -> "TBAGG" +"AssociationListAggregate(a:SetCategory,b:SetCategory)" -> + "TableAggregate(a:SetCategory,b:SetCategory)" +"ALAGG" -> "LSAGG" +"AssociationListAggregate(a:SetCategory,b:SetCategory)" -> + "ListAggregate(Record(a:SetCategory,b:SetCategory))" +@ <>= )abbrev category ALAGG AssociationListAggregate ++ Author: Michael Monagan; revised by Manuel Bronstein and Richard Jenks @@ -3117,6 +3185,10 @@ Note that this code is not included in the generated catdef.spad file. (DEFUN |AssociationListAggregate;| (|t#1| |t#2|) (PROG (#1=#:G88401) (RETURN (PROG1 (LETT #1# (|sublisV| (PAIR (QUOTE (|t#1| |t#2|)) (LIST (|devaluate| |t#1|) (|devaluate| |t#2|))) (|sublisV| (PAIR (QUOTE (#2=#:G88400)) (LIST (QUOTE (|Record| (|:| |key| |t#1|) (|:| |entry| |t#2|))))) (COND (|AssociationListAggregate;CAT|) ((QUOTE T) (LETT |AssociationListAggregate;CAT| (|Join| (|TableAggregate| (QUOTE |t#1|) (QUOTE |t#2|)) (|ListAggregate| (QUOTE #2#)) (|mkCategory| (QUOTE |domain|) (QUOTE (((|assoc| ((|Union| (|Record| (|:| |key| |t#1|) (|:| |entry| |t#2|)) "failed") |t#1| |$|)) T))) NIL (QUOTE NIL) NIL)) . #3=(|AssociationListAggregate|)))))) . #3#) (SETELT #1# 0 (LIST (QUOTE |AssociationListAggregate|) (|devaluate| |t#1|) (|devaluate| |t#2|))))))) @ \section{category SRAGG StringAggregate} +<>= +"SRAGG" -> "A1AGG" +"StringAggregate()" -> "OneDimensionalArrayAggregate(Character)" +@ <>= )abbrev category SRAGG StringAggregate ++ Author: Stephen Watt and Michael Monagan. revised by Manuel Bronstein and Richard Jenks @@ -3219,6 +3291,14 @@ StringAggregate: Category == OneDimensionalArrayAggregate Character with @ \section{category BTAGG BitAggregate} +<>= +"BTAGG" -> "ORDSET" +"BitAggregate()" -> "OrderedSet()" +"BTAGG" -> "LOGIC" +"BitAggregate()" -> "Logic()" +"BTAGG" -> "A1AGG" +"BitAggregate()" -> "OneDimensionalArrayAggregate(Boolean)" +@ <>= )abbrev category BTAGG BitAggregate ++ Author: Michael Monagan; revised by Manuel Bronstein and Richard Jenks