diff options
author | dos-reis <gdr@axiomatics.org> | 2013-05-20 14:47:59 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2013-05-20 14:47:59 +0000 |
commit | 63f62dc654697c60cfcf98d9fba5c7e1616061b0 (patch) | |
tree | 5e9dddeb91f546fcaf4da169b5d34492929d216f /src/algebra/aggcat.spad.pamphlet | |
parent | 1316b335ecc97eeaaa4c91258b31c789d8f4b0d3 (diff) | |
download | open-axiom-63f62dc654697c60cfcf98d9fba5c7e1616061b0.tar.gz |
* algebra/aggcat.spad.pamphlet (Collection) [find]: Move to
FiniteAggregate.
Diffstat (limited to 'src/algebra/aggcat.spad.pamphlet')
-rw-r--r-- | src/algebra/aggcat.spad.pamphlet | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/algebra/aggcat.spad.pamphlet b/src/algebra/aggcat.spad.pamphlet index ae602dc3..2dd2fc74 100644 --- a/src/algebra/aggcat.spad.pamphlet +++ b/src/algebra/aggcat.spad.pamphlet @@ -139,6 +139,9 @@ FiniteAggregate(S: Type): Category == Exports where ++ Returns \spad{f(x,y)} if \spad{u} has one element \spad{y}, ++ \spad{x} if \spad{u} is empty. For example, ++ \spad{reduce(+,u,0)} returns the sum of the elements of \spad{u}. + find: (S->Boolean, %) -> Union(S, "failed") + ++ \spad{find(p,u)} returns the first \spad{x} in \spad{u} such + ++ that \spad{p(x)} is true, and \spad{"failed"} otherwise. if S has BasicType then count: (S,%) -> NonNegativeInteger ++ \spad{count(x,u)} returns the number of occurrences @@ -162,6 +165,7 @@ FiniteAggregate(S: Type): Category == Exports where any?(f, x) == or/[f e for e in members x] every?(f, x) == and/[f e for e in members x] count(f:S -> Boolean, x:%) == +/[1 for e in members x | f e] + find(f:S -> Boolean, c:%) == find(f, members c) if S has BasicType then count(s:S, x:%) == count(s = #1, x) member?(e, x) == any?(e = #1,x) @@ -221,9 +225,6 @@ Collection(S:Type): Category == HomogeneousAggregate(S) with ++ \axiom{construct(x,y,...,z)} returns the collection of elements \axiom{x,y,...,z} ++ ordered as given. Equivalently written as \axiom{[x,y,...,z]$D}, where ++ D is the domain. D may be omitted for those of type List. - find: (S->Boolean, %) -> Union(S, "failed") - ++ find(p,u) returns the first x in u such that \axiom{p(x)} is true, and - ++ "failed" otherwise. if % has FiniteAggregate S then remove: (S->Boolean,%) -> % ++ remove(p,u) returns a copy of u removing all elements x such that @@ -243,7 +244,6 @@ Collection(S:Type): Category == HomogeneousAggregate(S) with if S has ConvertibleTo InputForm then ConvertibleTo InputForm add if % has FiniteAggregate S then - find(f:S -> Boolean, c:%) == find(f, members c) remove(f:S->Boolean, x:%) == construct remove(f, members x) select(f:S->Boolean, x:%) == |