aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog9
-rw-r--r--src/algebra/aggcat.spad.pamphlet35
-rw-r--r--src/algebra/stream.spad.pamphlet78
3 files changed, 47 insertions, 75 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 907a677e..dec9a8cb 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,14 @@
2013-05-19 Gabriel Dos Reis <gdr@integrable-solutions.net>
+ Eradicate attribute finiteAggregate.
+ * algebra/aggcat.spad.pamphlet (HomogeneousAggregate): Remove
+ exports conditional aatribute finiteAggregate.
+ (TableAggregate): Remove spirous definitions.
+ * algebra/stream.spad.pamphlet (LazyStreamAggregate): Put
+ definitions for FiniteAgregate exports under appropriate condition.
+
+2013-05-19 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
* algebra/aggcat.spad.pamphlet (Aggregate) [#]: Remove export.
(UnaryRecursiveAggregate): Make definiton conditional.
* algebra/stream.spad.pamphlet (LazyStreamAggregate): Likewise.
diff --git a/src/algebra/aggcat.spad.pamphlet b/src/algebra/aggcat.spad.pamphlet
index 79973f91..af8b3dcb 100644
--- a/src/algebra/aggcat.spad.pamphlet
+++ b/src/algebra/aggcat.spad.pamphlet
@@ -95,30 +95,6 @@ HomogeneousAggregate(S:Type): Category == Aggregate with
if % has shallowlyMutable then
map!: (S->S,%) -> %
++ map!(f,u) destructively replaces each element x of u by \axiom{f(x)}.
- if % has finiteAggregate then
- any?: (S->Boolean,%) -> Boolean
- ++ any?(p,u) tests if \axiom{p(x)} is true for any element x of u.
- ++ Note: for collections,
- ++ \axiom{any?(p,u) = reduce(or,map(f,u),false,true)}.
- every?: (S->Boolean,%) -> Boolean
- ++ every?(f,u) tests if p(x) is true for all elements x of u.
- ++ Note: for collections,
- ++ \axiom{every?(p,u) = reduce(and,map(f,u),true,false)}.
- count: (S->Boolean,%) -> NonNegativeInteger
- ++ count(p,u) returns the number of elements x in u
- ++ such that \axiom{p(x)} is true. For collections,
- ++ \axiom{count(p,u) = reduce(+,[1 for x in u | p(x)],0)}.
- members: % -> List S
- ++ members(u) returns a list of the consecutive elements of u.
- ++ For collections, \axiom{members([x,y,...,z]) = (x,y,...,z)}.
- if S has BasicType then
- count: (S,%) -> NonNegativeInteger
- ++ count(x,u) returns the number of occurrences of x in u.
- ++ For collections, \axiom{count(x,u) = reduce(+,[x=y for y in u],0)}.
- member?: (S,%) -> Boolean
- ++ member?(x,u) tests if x is a member of u.
- ++ For collections,
- ++ \axiom{member?(x,u) = reduce(or,[x=y for y in u],false)}.
add
if S has Evalable S then
eval(u:%,l:List Equation S):% == map(eval(#1,l),u)
@@ -1195,17 +1171,6 @@ TableAggregate(Key:SetCategory, Entry:SetCategory): Category ==
remove!(k.key, t)
k
- any?(f: Entry->Boolean, t: %): Boolean ==
- for k in keys t | f t k repeat return true
- false
- every?(f: Entry->Boolean, t: %): Boolean ==
- for k in keys t | not f t k repeat return false
- true
- count(f: Entry->Boolean, t: %): NonNegativeInteger ==
- tally: NonNegativeInteger := 0
- for k in keys t | f t k repeat tally := tally + 1
- tally
-
@
\section{category RCAGG RecursiveAggregate}
diff --git a/src/algebra/stream.spad.pamphlet b/src/algebra/stream.spad.pamphlet
index 7b2db025..c6fe7d85 100644
--- a/src/algebra/stream.spad.pamphlet
+++ b/src/algebra/stream.spad.pamphlet
@@ -134,35 +134,33 @@ LazyStreamAggregate(S:Type): Category == StreamAggregate(S) with
if odd? i then x := rst x
eq?(x,y) => error "#: infinite stream"
---% CLAGG functions
-
- any?(f,x) ==
- -- error message only when x is a stream with lazy
- -- evaluation and f(s) = false for all stream elements
- -- 's' which have been computed when the function is
- -- called
- y := x
- for i in 0.. repeat
- explicitlyEmpty? y => return false
- lazy? y => error "any?: infinite stream"
- f frst y => return true
- y := rst y
- if odd? i then x := rst x
- eq?(x,y) => return false
+ any?(f,x) ==
+ -- error message only when x is a stream with lazy
+ -- evaluation and f(s) = false for all stream elements
+ -- 's' which have been computed when the function is
+ -- called
+ y := x
+ for i in 0.. repeat
+ explicitlyEmpty? y => return false
+ lazy? y => error "any?: infinite stream"
+ f frst y => return true
+ y := rst y
+ if odd? i then x := rst x
+ eq?(x,y) => return false
- every?(f,x) ==
- -- error message only when x is a stream with lazy
- -- evaluation and f(s) = true for all stream elements
- -- 's' which have been computed when the function is
- -- called
- y := x
- for i in 0.. repeat
- explicitlyEmpty? y => return true
- lazy? y => error "every?: infinite stream"
- not f frst y => return false
- y := rst y
- if odd? i then x := rst x
- eq?(x,y) => return true
+ every?(f,x) ==
+ -- error message only when x is a stream with lazy
+ -- evaluation and f(s) = true for all stream elements
+ -- 's' which have been computed when the function is
+ -- called
+ y := x
+ for i in 0.. repeat
+ explicitlyEmpty? y => return true
+ lazy? y => error "every?: infinite stream"
+ not f frst y => return false
+ y := rst y
+ if odd? i then x := rst x
+ eq?(x,y) => return true
-- following ops count and member? are only exported if $ has FiniteAggregate S
@@ -197,18 +195,18 @@ LazyStreamAggregate(S:Type): Category == StreamAggregate(S) with
-- if odd? i then x := rst x
-- eq?(x,y) => return false
- entries x ==
- -- returns a list of elements which have been computed
- -- error if infinite
- y := x
- l : L S := empty()
- for i in 0.. repeat
- explicitlyEmpty? y => return reverse! l
- lazy? y => error "infinite stream"
- l := concat(frst y,l)
- y := rst y
- if odd? i then x := rst x
- eq?(x,y) => error "infinite stream"
+ entries x ==
+ -- returns a list of elements which have been computed
+ -- error if infinite
+ y := x
+ l : L S := empty()
+ for i in 0.. repeat
+ explicitlyEmpty? y => return reverse! l
+ lazy? y => error "infinite stream"
+ l := concat(frst y,l)
+ y := rst y
+ if odd? i then x := rst x
+ eq?(x,y) => error "infinite stream"
--% CNAGG functions