From cc69cdefa3acf48bad75ac52f55cd9f27c970eab Mon Sep 17 00:00:00 2001 From: dos-reis Date: Sun, 19 May 2013 17:44:50 +0000 Subject: * algebra/aggcat.spad.pamphlet (Aggregate) [#]: Remove export. (UnaryRecursiveAggregate): Make definiton conditional. * algebra/stream.spad.pamphlet (LazyStreamAggregate): Likewise. --- src/algebra/aggcat.spad.pamphlet | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/algebra/aggcat.spad.pamphlet') diff --git a/src/algebra/aggcat.spad.pamphlet b/src/algebra/aggcat.spad.pamphlet index b0395fe0..79973f91 100644 --- a/src/algebra/aggcat.spad.pamphlet +++ b/src/algebra/aggcat.spad.pamphlet @@ -49,8 +49,6 @@ Aggregate: Category == Type with empty?: % -> Boolean ++ empty?(u) tests if u has 0 elements. sample: constant -> % ++ sample yields a value of type % - if % has finiteAggregate then - #: % -> NonNegativeInteger ++ # u returns the number of items in u. add eq?(a,b) == %peq(a,b)$Foreign(Builtin) sample() == empty() @@ -1593,13 +1591,14 @@ UnaryRecursiveAggregate(S:Type): Category == RecursiveAggregate S with empty? x => error "value of empty object" first x - #x == - k: NonNegativeInteger := 0 - while not empty? x repeat - k = cycleMax and cyclic? x => error "cyclic list" - x := rest x - k := k + 1 - k + if % has FiniteAggregate S then + #x == + k: NonNegativeInteger := 0 + while not empty? x repeat + k = cycleMax and cyclic? x => error "cyclic list" + x := rest x + k := k + 1 + k tail x == empty? x => error "empty list" -- cgit v1.2.3