Stream(S)
stream.spad line 534
[edit on github]
A stream is an implementation of a possibly infinite sequence using a list of terms that have been computed and a function closure to compute additional terms when needed.
- < : (%, %) -> Boolean if S has OrderedSet and % has finiteAggregate
- from PartialOrder
- <= : (%, %) -> Boolean if S has OrderedSet and % has finiteAggregate
- from PartialOrder
- = : (%, %) -> Boolean if S has Hashable and % has finiteAggregate or S has BasicType and % has finiteAggregate or S has SetCategory
- from BasicType
- > : (%, %) -> Boolean if S has OrderedSet and % has finiteAggregate
- from PartialOrder
- >= : (%, %) -> Boolean if S has OrderedSet and % has finiteAggregate
- from PartialOrder
- child? : (%, %) -> Boolean if S has BasicType
- from RecursiveAggregate(S)
- children : % -> List(%)
- from RecursiveAggregate(S)
- coerce : List(S) -> %
coerce(l)
converts a list l
to a stream.
- coerce : % -> OutputForm if S has CoercibleTo(OutputForm)
- from CoercibleTo(OutputForm)
- complete : % -> %
- from LazyStreamAggregate(S)
- concat : (%, %) -> %
- from LinearAggregate(S)
- concat : (%, S) -> %
- from LinearAggregate(S)
- concat : (S, %) -> %
- from LinearAggregate(S)
- concat : List(%) -> %
- from LinearAggregate(S)
- concat! : (%, %) -> %
- from UnaryRecursiveAggregate(S)
- concat! : (%, S) -> %
- from UnaryRecursiveAggregate(S)
- concat! : List(%) -> %
- from UnaryRecursiveAggregate(S)
- cons : (S, %) -> %
cons(a, s)
returns a stream whose first
is a
and whose rest
is s
. Note: cons(a, s) = concat(a, s)
.
- construct : List(S) -> %
- from Collection(S)
- convert : % -> InputForm if S has ConvertibleTo(InputForm)
- from ConvertibleTo(InputForm)
- copy : % -> %
- from Aggregate
- count : (S, %) -> NonNegativeInteger if S has BasicType and % has finiteAggregate
- from HomogeneousAggregate(S)
- cycleEntry : % -> %
- from UnaryRecursiveAggregate(S)
- cycleLength : % -> NonNegativeInteger
- from UnaryRecursiveAggregate(S)
- cycleSplit! : % -> %
- from UnaryRecursiveAggregate(S)
- cycleTail : % -> %
- from UnaryRecursiveAggregate(S)
- cyclic? : % -> Boolean
- from RecursiveAggregate(S)
- delay : Mapping(%) -> %
delay(f)
creates a stream with a lazy evaluation defined by function f
. Caution: This function can only be called in compiled code.
- 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)
- explicitEntries? : % -> Boolean
- from LazyStreamAggregate(S)
- explicitlyEmpty? : % -> Boolean
- from LazyStreamAggregate(S)
- explicitlyFinite? : % -> Boolean
- from StreamAggregate(S)
- extend : (%, Integer) -> %
- from LazyStreamAggregate(S)
- fill! : (%, S) -> %
- from IndexedAggregate(Integer, S)
- filterUntil : (Mapping(Boolean, S), %) -> %
filterUntil(p, s)
returns [x0, x1, ..., x(n)]
where s = [x0, x1, x2, ..]
and n
is the smallest index such that p(xn) = true
.
- filterWhile : (Mapping(Boolean, S), %) -> %
filterWhile(p, s)
returns [x0, x1, ..., x(n-1)]
where s = [x0, x1, x2, ..]
and n
is the smallest index such that p(xn) = false
.
- find : (Mapping(Boolean, S), %) -> Union(S, "failed")
- from Collection(S)
- findCycle : (NonNegativeInteger, %) -> Record(cycle? : Boolean, prefix : NonNegativeInteger, period : NonNegativeInteger)
findCycle(n, st)
determines if st is periodic within n
.
- first : (%, NonNegativeInteger) -> %
- from LinearAggregate(S)
- first : % -> S
- from IndexedAggregate(Integer, S)
- frst : % -> S
- from LazyStreamAggregate(S)
- 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
- from LazyStreamAggregate(S)
- lazyEvaluate : % -> %
- from LazyStreamAggregate(S)
- 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), %) -> %
- 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)
- maxIndex : % -> Integer
- from IndexedAggregate(Integer, S)
- member? : (S, %) -> Boolean if S has BasicType and % has finiteAggregate
- from HomogeneousAggregate(S)
- merge : (%, %) -> % if S has OrderedSet and % 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
- from LazyStreamAggregate(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)
- possiblyInfinite? : % -> Boolean
- from StreamAggregate(S)
- qelt : (%, Integer) -> S
- from EltableAggregate(Integer, S)
- qsetelt! : (%, Integer, S) -> S
- from EltableAggregate(Integer, S)
- qsetfirst! : (%, S) -> S
- from UnaryRecursiveAggregate(S)
- qsetrest! : (%, %) -> %
- from UnaryRecursiveAggregate(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), %) -> %
- from LazyStreamAggregate(S)
- removeDuplicates : % -> % if S has BasicType and % has finiteAggregate
- from Collection(S)
- repeating : List(S) -> %
repeating(l)
is a repeating stream whose period is the list l
.
- repeating? : (List(S), %) -> Boolean if S has SetCategory
repeating?(l, s)
returns true
if a stream s
is periodic with period l
, and false
otherwise.
- rest : % -> %
- from UnaryRecursiveAggregate(S)
- rest : (%, NonNegativeInteger) -> %
- from UnaryRecursiveAggregate(S)
- rightTrim : (%, S) -> % if S has BasicType and % has finiteAggregate
- from LinearAggregate(S)
- rst : % -> %
- from LazyStreamAggregate(S)
- sample : () -> %
- from Aggregate
- second : % -> S
- from UnaryRecursiveAggregate(S)
- select : (Mapping(Boolean, S), %) -> %
- from LazyStreamAggregate(S)
- setchildren! : (%, List(%)) -> %
- from RecursiveAggregate(S)
- setelt! : (%, "rest", %) -> %
- from UnaryRecursiveAggregate(S)
- setelt! : (%, "first", S) -> S
- from UnaryRecursiveAggregate(S)
- setelt! : (%, "last", S) -> S
- from UnaryRecursiveAggregate(S)
- setelt! : (%, "value", S) -> S
- from RecursiveAggregate(S)
- setelt! : (%, Integer, S) -> S
- from EltableAggregate(Integer, S)
- setelt! : (%, UniversalSegment(Integer), S) -> S
- from LinearAggregate(S)
- setfirst! : (%, S) -> S
- from UnaryRecursiveAggregate(S)
- setlast! : (%, S) -> S
- from UnaryRecursiveAggregate(S)
- setrest! : (%, %) -> %
- from UnaryRecursiveAggregate(S)
- setrest! : (%, Integer, %) -> %
setrest!(x, n, y)
sets rest(x
, n
) to y
. The function will expand cycles if necessary.
- setvalue! : (%, S) -> S
- from RecursiveAggregate(S)
- showAll? : () -> Boolean if S has SetCategory
showAll?()
returns true
if all computed entries of streams will be displayed.
- showAllElements : % -> OutputForm if S has SetCategory
showAllElements(s)
creates an output form which displays all computed elements.
- showElements : (NonNegativeInteger, %) -> OutputForm if S has SetCategory
showElements(n, st)
computes and creates and output form of the first n
entries of st.
- size? : (%, NonNegativeInteger) -> Boolean
- from Aggregate
- smaller? : (%, %) -> Boolean if % has finiteAggregate and S has Comparable or S has OrderedSet and % has finiteAggregate
- from Comparable
- sort : % -> % if S has OrderedSet and % has finiteAggregate
- from LinearAggregate(S)
- sort! : % -> % if S has OrderedSet and % has finiteAggregate
- from LinearAggregate(S)
- sorted? : % -> Boolean if S has OrderedSet and % has finiteAggregate
- from LinearAggregate(S)
- split! : (%, NonNegativeInteger) -> %
- from UnaryRecursiveAggregate(S)
- stream : Mapping(S) -> %
stream(f)
creates an infinite stream all of whose elements are equal to f()
. Note: stream(f) = [f(), f(), f(), ...]
.
- stream : (Mapping(S, S), S) -> %
stream(f, x)
creates an infinite stream whose first element is x
and whose n
th element (n > 1
) is f
applied to the previous element. Note: stream(f, x) = [x, f(x), f(f(x)), ...]
.
- swap! : (%, Integer, Integer) -> Void
- 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 Hashable and % has finiteAggregate or S has BasicType and % has finiteAggregate or S has SetCategory
- from BasicType
HomogeneousAggregate(S)
ConvertibleTo(InputForm)
OrderedSet
shallowlyMutable
Collection(S)
LinearAggregate(S)
EltableAggregate(Integer, S)
PartialOrder
Aggregate
Eltable(UniversalSegment(Integer), %)
InnerEvalable(S, S)
Comparable
RecursiveAggregate(S)
LazyStreamAggregate(S)
StreamAggregate(S)
Hashable
UnaryRecursiveAggregate(S)
CoercibleTo(OutputForm)
Eltable(Integer, S)
IndexedAggregate(Integer, S)
BasicType
Evalable(S)
SetCategory