LazyStreamAggregate(S)

stream.spad line 1 [edit on github]

LazyStreamAggregate is the category of streams with lazy evaluation. It is understood that the function 'empty?' will cause lazy evaluation if necessary to determine if there are entries. Functions which call 'empty?', e.g. 'first' and 'rest', will also cause lazy evaluation if necessary. Elements of LazyStreamAggregate are computed only when strictly needed. Lazy computation means that potential errors are delayed, so errors are detected later than in case of normal (eager) evaluation used by other aggregates. In some cases computation that would signal error when using eager evaluation can succeed when using lazy evaluation.

# : % -> NonNegativeInteger if % has finiteAggregate
from Aggregate
< : (%, %) -> Boolean if S has OrderedSet and % has finiteAggregate
from PartialOrder
<= : (%, %) -> Boolean if S has OrderedSet and % has finiteAggregate
from PartialOrder
= : (%, %) -> Boolean if S has SetCategory or S has BasicType and % has finiteAggregate or S has Hashable and % has finiteAggregate
from BasicType
> : (%, %) -> Boolean if S has OrderedSet and % has finiteAggregate
from PartialOrder
>= : (%, %) -> Boolean if S has OrderedSet and % has finiteAggregate
from PartialOrder
any? : (Mapping(Boolean, S), %) -> Boolean if % has finiteAggregate
from HomogeneousAggregate(S)
child? : (%, %) -> Boolean if S has BasicType
from RecursiveAggregate(S)
children : % -> List(%)
from RecursiveAggregate(S)
coerce : % -> OutputForm if S has CoercibleTo(OutputForm)
from CoercibleTo(OutputForm)
complete : % -> %

complete(st) causes all entries of 'st' to be computed. this function should only be called on streams which are known to be finite.

concat : (%, %) -> %
from LinearAggregate(S)
concat : (%, S) -> %
from LinearAggregate(S)
concat : (S, %) -> %
from LinearAggregate(S)
concat : List(%) -> %
from LinearAggregate(S)
concat! : (%, %) -> % if % has shallowlyMutable
from UnaryRecursiveAggregate(S)
concat! : (%, S) -> % if % has shallowlyMutable
from UnaryRecursiveAggregate(S)
concat! : List(%) -> % if % has shallowlyMutable
from UnaryRecursiveAggregate(S)
construct : List(S) -> %
from Collection(S)
convert : % -> InputForm if S has ConvertibleTo(InputForm)
from ConvertibleTo(InputForm)
copy : % -> %
from Aggregate
copyInto! : (%, %, Integer) -> % if % has finiteAggregate and % has shallowlyMutable
from LinearAggregate(S)
count : (S, %) -> NonNegativeInteger if S has BasicType and % has finiteAggregate
from HomogeneousAggregate(S)
count : (Mapping(Boolean, S), %) -> NonNegativeInteger if % has finiteAggregate
from HomogeneousAggregate(S)
cycleEntry : % -> %
from UnaryRecursiveAggregate(S)
cycleLength : % -> NonNegativeInteger
from UnaryRecursiveAggregate(S)
cycleSplit! : % -> % if % has shallowlyMutable
from UnaryRecursiveAggregate(S)
cycleTail : % -> %
from UnaryRecursiveAggregate(S)
cyclic? : % -> Boolean
from RecursiveAggregate(S)
delete : (%, Integer) -> %
from LinearAggregate(S)
delete : (%, UniversalSegment(Integer)) -> %
from LinearAggregate(S)
distance : (%, %) -> Integer
from RecursiveAggregate(S)
elt : (%, "rest") -> %
from UnaryRecursiveAggregate(S)
elt : (%, UniversalSegment(Integer)) -> %
from Eltable(UniversalSegment(Integer), %)
elt : (%, "first") -> S
from UnaryRecursiveAggregate(S)
elt : (%, "last") -> S
from UnaryRecursiveAggregate(S)
elt : (%, "value") -> S
from RecursiveAggregate(S)
elt : (%, Integer) -> S
from Eltable(Integer, S)
elt : (%, Integer, S) -> S
from EltableAggregate(Integer, S)
empty : () -> %
from Aggregate
empty? : % -> Boolean
from Aggregate
entries : % -> List(S)
from IndexedAggregate(Integer, S)
entry? : (S, %) -> Boolean if S has BasicType and % has finiteAggregate
from IndexedAggregate(Integer, S)
eq? : (%, %) -> Boolean
from Aggregate
eval : (%, S, S) -> % if S has Evalable(S) and S has SetCategory
from InnerEvalable(S, S)
eval : (%, Equation(S)) -> % if S has Evalable(S) and S has SetCategory
from Evalable(S)
eval : (%, List(S), List(S)) -> % if S has Evalable(S) and S has SetCategory
from InnerEvalable(S, S)
eval : (%, List(Equation(S))) -> % if S has Evalable(S) and S has SetCategory
from Evalable(S)
every? : (Mapping(Boolean, S), %) -> Boolean if % has finiteAggregate
from HomogeneousAggregate(S)
explicitEntries? : % -> Boolean

explicitEntries?(s) returns true if the stream s has explicitly computed entries, and false otherwise.

explicitlyEmpty? : % -> Boolean

explicitlyEmpty?(s) returns true if the stream is an (explicitly) empty stream. Note: this is a null test which will not cause lazy evaluation.

explicitlyFinite? : % -> Boolean
from StreamAggregate(S)
extend : (%, Integer) -> %

extend(st, n) causes entries to be computed, if necessary, so that 'st' will have at least 'n' explicit entries or so that all entries of 'st' will be computed if 'st' is finite with length <= n.

fill! : (%, S) -> % if % has shallowlyMutable
from IndexedAggregate(Integer, S)
find : (Mapping(Boolean, S), %) -> Union(S, "failed")
from Collection(S)
first : (%, NonNegativeInteger) -> %
from LinearAggregate(S)
first : % -> S
from IndexedAggregate(Integer, S)
frst : % -> S

frst(s) returns the first element of stream s. Caution: this function should only be called after a empty? test has been made since there is no error check.

hash : % -> SingleInteger if S has Hashable and % has finiteAggregate
from Hashable
hashUpdate! : (HashState, %) -> HashState if S has Hashable and % has finiteAggregate
from Hashable
index? : (Integer, %) -> Boolean
from IndexedAggregate(Integer, S)
indices : % -> List(Integer)
from IndexedAggregate(Integer, S)
insert : (%, %, Integer) -> %
from LinearAggregate(S)
insert : (S, %, Integer) -> %
from LinearAggregate(S)
last : (%, NonNegativeInteger) -> %
from UnaryRecursiveAggregate(S)
last : % -> S
from UnaryRecursiveAggregate(S)
latex : % -> String if S has SetCategory
from SetCategory
lazy? : % -> Boolean

lazy?(s) returns true if the first node of the stream s is a lazy evaluation mechanism which could produce an additional entry to s.

lazyEvaluate : % -> %

lazyEvaluate(s) causes one lazy evaluation of stream s. Caution: the first node must be a lazy evaluation mechanism (satisfies lazy?(s) = true) as there is no error check. Note: a call to this function may or may not produce an explicit first entry

leaf? : % -> Boolean
from RecursiveAggregate(S)
leaves : % -> List(S)
from RecursiveAggregate(S)
leftTrim : (%, S) -> % if S has BasicType and % has finiteAggregate
from LinearAggregate(S)
less? : (%, NonNegativeInteger) -> Boolean
from Aggregate
map : (Mapping(S, S), %) -> %
from HomogeneousAggregate(S)
map : (Mapping(S, S, S), %, %) -> %
from LinearAggregate(S)
map! : (Mapping(S, S), %) -> % if % has shallowlyMutable
from HomogeneousAggregate(S)
max : (%, %) -> % if S has OrderedSet and % has finiteAggregate
from OrderedSet
max : % -> S if S has OrderedSet and % has finiteAggregate
from HomogeneousAggregate(S)
max : (Mapping(Boolean, S, S), %) -> S if % has finiteAggregate
from HomogeneousAggregate(S)
maxIndex : % -> Integer
from IndexedAggregate(Integer, S)
member? : (S, %) -> Boolean if S has BasicType and % has finiteAggregate
from HomogeneousAggregate(S)
members : % -> List(S) if % has finiteAggregate
from HomogeneousAggregate(S)
merge : (%, %) -> % if S has OrderedSet and % has finiteAggregate
from LinearAggregate(S)
merge : (Mapping(Boolean, S, S), %, %) -> % if % has finiteAggregate
from LinearAggregate(S)
min : (%, %) -> % if S has OrderedSet and % has finiteAggregate
from OrderedSet
min : % -> S if S has OrderedSet and % has finiteAggregate
from HomogeneousAggregate(S)
minIndex : % -> Integer
from IndexedAggregate(Integer, S)
more? : (%, NonNegativeInteger) -> Boolean
from Aggregate
new : (NonNegativeInteger, S) -> %
from LinearAggregate(S)
node? : (%, %) -> Boolean if S has BasicType
from RecursiveAggregate(S)
nodes : % -> List(%)
from RecursiveAggregate(S)
numberOfComputedEntries : % -> NonNegativeInteger

numberOfComputedEntries(st) returns the number of explicitly computed entries of stream st which exist immediately prior to the time this function is called.

parts : % -> List(S) if % has finiteAggregate
from HomogeneousAggregate(S)
position : (S, %) -> Integer if S has BasicType and % has finiteAggregate
from LinearAggregate(S)
position : (S, %, Integer) -> Integer if S has BasicType and % has finiteAggregate
from LinearAggregate(S)
position : (Mapping(Boolean, S), %) -> Integer if % has finiteAggregate
from LinearAggregate(S)
possiblyInfinite? : % -> Boolean
from StreamAggregate(S)
qelt : (%, Integer) -> S
from EltableAggregate(Integer, S)
qsetelt! : (%, Integer, S) -> S if % has shallowlyMutable
from EltableAggregate(Integer, S)
qsetfirst! : (%, S) -> S if % has shallowlyMutable
from UnaryRecursiveAggregate(S)
qsetrest! : (%, %) -> % if % has shallowlyMutable
from UnaryRecursiveAggregate(S)
reduce : (Mapping(S, S, S), %) -> S if % has finiteAggregate
from Collection(S)
reduce : (Mapping(S, S, S), %, S) -> S if % has finiteAggregate
from Collection(S)
reduce : (Mapping(S, S, S), %, S, S) -> S if S has BasicType and % has finiteAggregate
from Collection(S)
remove : (S, %) -> % if S has BasicType and % has finiteAggregate
from Collection(S)
remove : (Mapping(Boolean, S), %) -> %

remove(f, st) returns a stream consisting of those elements of stream st which do not satisfy the predicate f. Note: remove(f, st) = [x for x in st | not f(x)].

removeDuplicates : % -> % if S has BasicType and % has finiteAggregate
from Collection(S)
rest : % -> %
from UnaryRecursiveAggregate(S)
rest : (%, NonNegativeInteger) -> %
from UnaryRecursiveAggregate(S)
reverse : % -> % if % has finiteAggregate
from LinearAggregate(S)
reverse! : % -> % if % has finiteAggregate and % has shallowlyMutable
from LinearAggregate(S)
rightTrim : (%, S) -> % if S has BasicType and % has finiteAggregate
from LinearAggregate(S)
rst : % -> %

rst(s) returns a pointer to the next node of stream s. Caution: this function should only be called after a empty? test has been made since there is no error check.

sample : () -> %
from Aggregate
second : % -> S
from UnaryRecursiveAggregate(S)
select : (Mapping(Boolean, S), %) -> %

select(f, st) returns a stream consisting of those elements of stream st satisfying the predicate f. Note: select(f, st) = [x for x in st | f(x)].

setchildren! : (%, List(%)) -> % if % has shallowlyMutable
from RecursiveAggregate(S)
setelt! : (%, "rest", %) -> % if % has shallowlyMutable
from UnaryRecursiveAggregate(S)
setelt! : (%, "first", S) -> S if % has shallowlyMutable
from UnaryRecursiveAggregate(S)
setelt! : (%, "last", S) -> S if % has shallowlyMutable
from UnaryRecursiveAggregate(S)
setelt! : (%, "value", S) -> S if % has shallowlyMutable
from RecursiveAggregate(S)
setelt! : (%, Integer, S) -> S if % has shallowlyMutable
from EltableAggregate(Integer, S)
setelt! : (%, UniversalSegment(Integer), S) -> S if % has shallowlyMutable
from LinearAggregate(S)
setfirst! : (%, S) -> S if % has shallowlyMutable
from UnaryRecursiveAggregate(S)
setlast! : (%, S) -> S if % has shallowlyMutable
from UnaryRecursiveAggregate(S)
setrest! : (%, %) -> % if % has shallowlyMutable
from UnaryRecursiveAggregate(S)
setvalue! : (%, S) -> S if % has shallowlyMutable
from RecursiveAggregate(S)
size? : (%, NonNegativeInteger) -> Boolean
from Aggregate
smaller? : (%, %) -> Boolean if S has OrderedSet and % has finiteAggregate or % has finiteAggregate and S has Comparable
from Comparable
sort : % -> % if S has OrderedSet and % has finiteAggregate
from LinearAggregate(S)
sort : (Mapping(Boolean, S, S), %) -> % if % has finiteAggregate
from LinearAggregate(S)
sort! : % -> % if S has OrderedSet and % has finiteAggregate and % has shallowlyMutable
from LinearAggregate(S)
sort! : (Mapping(Boolean, S, S), %) -> % if % has finiteAggregate and % has shallowlyMutable
from LinearAggregate(S)
sorted? : % -> Boolean if S has OrderedSet and % has finiteAggregate
from LinearAggregate(S)
sorted? : (Mapping(Boolean, S, S), %) -> Boolean if % has finiteAggregate
from LinearAggregate(S)
split! : (%, NonNegativeInteger) -> % if % has shallowlyMutable
from UnaryRecursiveAggregate(S)
swap! : (%, Integer, Integer) -> Void if % has shallowlyMutable
from IndexedAggregate(Integer, S)
tail : % -> %
from UnaryRecursiveAggregate(S)
third : % -> S
from UnaryRecursiveAggregate(S)
trim : (%, S) -> % if S has BasicType and % has finiteAggregate
from LinearAggregate(S)
value : % -> S
from RecursiveAggregate(S)
~= : (%, %) -> Boolean if S has SetCategory or S has BasicType and % has finiteAggregate or S has Hashable and % has finiteAggregate
from BasicType

Comparable

ConvertibleTo(InputForm)

UnaryRecursiveAggregate(S)

OrderedSet

InnerEvalable(S, S)

StreamAggregate(S)

RecursiveAggregate(S)

Eltable(Integer, S)

LinearAggregate(S)

IndexedAggregate(Integer, S)

SetCategory

HomogeneousAggregate(S)

PartialOrder

CoercibleTo(OutputForm)

Collection(S)

Aggregate

Eltable(UniversalSegment(Integer), %)

EltableAggregate(Integer, S)

Hashable

Evalable(S)

BasicType