aboutsummaryrefslogtreecommitdiff
path: root/src/algebra/stream.spad.pamphlet
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2013-05-19 18:36:07 +0000
committerdos-reis <gdr@axiomatics.org>2013-05-19 18:36:07 +0000
commitd9777ce9dcd2bcde348bba152d4667559b025d9d (patch)
treee97588cce6d9c9866b8027cffe41dc578efe102b /src/algebra/stream.spad.pamphlet
parentcc69cdefa3acf48bad75ac52f55cd9f27c970eab (diff)
downloadopen-axiom-d9777ce9dcd2bcde348bba152d4667559b025d9d.tar.gz
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.
Diffstat (limited to 'src/algebra/stream.spad.pamphlet')
-rw-r--r--src/algebra/stream.spad.pamphlet78
1 files changed, 38 insertions, 40 deletions
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