From 1b0bb495c53cbd98069caeb30089c5ff778aceb3 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Thu, 16 May 2013 20:17:37 +0000 Subject: * algebra/aggcat.spad.pamphlet (FiniteAggregate): Temporarily include attribute finiteAggregate. (StackAggregate): Extend category FiniteAggregate instead of attribute finiteAggregate. (QueueAggregate): Likewise. (PriorityQueueAggregate): Likewise. (FiniteSetAggregate): Likewise. * algebra/lmdict.spad.pamphlet (ListMultiDictionary): Likewise. * algebra/matcat.spad.pamphlet (MatrixCategory): Likewise. * algebra/mset.spad.pamphlet (Multiset): Likewise. * algebra/newdata.spad.pamphlet (SplittingTree): Likewise. * algebra/polset.spad.pamphlet (PolynomialSetCategory): Likewise. * algebra/tree.spad.pamphlet (Tree): Likewise. (BinaryTreeCategory): Likewise. * algebra/triset.spad.pamphlet (TriangularSetCategory): Likewise. * algebra/vector.spad.pamphlet (DirectProductCategory): Likewise. --- src/algebra/aggcat.spad.pamphlet | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src/algebra/aggcat.spad.pamphlet') diff --git a/src/algebra/aggcat.spad.pamphlet b/src/algebra/aggcat.spad.pamphlet index 938a09fb..83667f77 100644 --- a/src/algebra/aggcat.spad.pamphlet +++ b/src/algebra/aggcat.spad.pamphlet @@ -168,6 +168,7 @@ HomogeneousAggregate(S:Type): Category == Aggregate with ++ number of elements. FiniteAggregate(S: Type): Category == Exports where Exports == HomogeneousAggregate S with + finiteAggregate -- FIXME: TEMPORARY FOR TRANSITIONAL PURPOSE ONLY #: % -> NonNegativeInteger ++ \spad{#u} returns the number of items in u. any?: (S->Boolean,%) -> Boolean @@ -346,8 +347,7 @@ import BagAggregate ++ References: ++ Description: ++ A stack is a bag where the last item inserted is the first item extracted. -StackAggregate(S:Type): Category == BagAggregate S with - finiteAggregate +StackAggregate(S:Type): Category == Join(BagAggregate S,FiniteAggregate S) with push!: (S,%) -> S ++ push!(x,s) pushes x onto stack s, i.e. destructively changing s ++ so as to have a new first (top) element x. @@ -383,8 +383,7 @@ import BagAggregate ++ References: ++ Description: ++ A queue is a bag where the first item inserted is the first item extracted. -QueueAggregate(S:Type): Category == BagAggregate S with - finiteAggregate +QueueAggregate(S:Type): Category == Join(BagAggregate S,FiniteAggregate S) with enqueue!: (S, %) -> S ++ enqueue!(x,q) inserts x into the queue q at the back end. dequeue!: % -> S @@ -481,8 +480,7 @@ import BagAggregate ++ Description: ++ A priority queue is a bag of items from an ordered set where the item ++ extracted is always the maximum element. -PriorityQueueAggregate(S:OrderedSet): Category == BagAggregate S with - finiteAggregate +PriorityQueueAggregate(S:OrderedSet): Category == Join(BagAggregate S,FiniteAggregate S) with max: % -> S ++ max(q) returns the maximum element of priority queue q. merge: (%,%) -> % @@ -737,8 +735,7 @@ import SetAggregate ++ by order or multiplicity. ++ See \spadtype{Set} for an example. FiniteSetAggregate(S:SetCategory): Category == - Join(Dictionary S, SetAggregate S) with - finiteAggregate + Join(Dictionary S, SetAggregate S,FiniteAggregate S) with cardinality: % -> NonNegativeInteger ++ cardinality(u) returns the number of elements of u. ++ Note: \axiom{cardinality(u) = #u}. @@ -1937,8 +1934,7 @@ import Integer ++ The finite property of the aggregate adds several exports to the ++ list of exports from \spadtype{LinearAggregate} such as ++ \spadfun{reverse}, \spadfun{sort}, and so on. -FiniteLinearAggregate(S:Type): Category == LinearAggregate S with - finiteAggregate +FiniteLinearAggregate(S:Type): Category == Join(LinearAggregate S,FiniteAggregate S) with merge: ((S,S)->Boolean,%,%) -> % ++ merge(p,a,b) returns an aggregate c which merges \axiom{a} and b. ++ The result is produced by examining each element x of \axiom{a} and y -- cgit v1.2.3