aboutsummaryrefslogtreecommitdiff
path: root/src/algebra/stream.spad.pamphlet
diff options
context:
space:
mode:
Diffstat (limited to 'src/algebra/stream.spad.pamphlet')
-rw-r--r--src/algebra/stream.spad.pamphlet20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/algebra/stream.spad.pamphlet b/src/algebra/stream.spad.pamphlet
index 90fd504c..7b2db025 100644
--- a/src/algebra/stream.spad.pamphlet
+++ b/src/algebra/stream.spad.pamphlet
@@ -122,15 +122,17 @@ LazyStreamAggregate(S:Type): Category == StreamAggregate(S) with
empty? x => n = 0
size?(rst x,(n-1) :: NNI)
- # x ==
- -- error if stream is not finite
- y := x
- for i in 0.. repeat
- explicitlyEmpty? y => return i
- lazy? y => error "#: infinite stream"
- y := rst y
- if odd? i then x := rst x
- eq?(x,y) => error "#: infinite stream"
+--% FINAGG functions
+ if % has FiniteAggregate S then
+ # x ==
+ -- error if stream is not finite
+ y := x
+ for i in 0.. repeat
+ explicitlyEmpty? y => return i
+ lazy? y => error "#: infinite stream"
+ y := rst y
+ if odd? i then x := rst x
+ eq?(x,y) => error "#: infinite stream"
--% CLAGG functions