Iterator
enum Iterator[a: Type, ef: Eff, r: Eff]Sourcecase Iterator(Region[r], Unit -> Step[a] \ r + ef)Definitions
def append(iter1: Iterator[a, ef1, r], iter2: Iterator[a, ef2, r]): Iterator[a, ef1 + ef2, r]§ SourceReturns iterB appended to (the end of) iterA.
Does not consume any elements from either iterator.
The original iterators iterA and iterB should not be reused.
Returns an iterator with the element x appended to the
front of iterator iter.
Does not consume any elements from the iterator.
The original iterator iter should not be reused.
Returns iter without the first n elements.
Returns an empty iterator if n is larger than the number of elements in iter.
Returns iter if n < 0.
Does not consume any elements from the iterator.
The original iterator iter should not be reused.
def dropWhile(f: a -> Bool \ ef2, iter: Iterator[a, ef1, r]): Iterator[a, r + ef1 + ef2, r] \ r§ SourceReturns iter without the longest prefix that satisfies the predicate f.
Does not consume any elements from the iterator.
The original iterator iter should not be reused.
Returns an iterator with every element of the iterator iter that
satisfies the predicate f.
Does not consume any elements from the iterator.
The original iterator iter should not be reused.
def filterMap(f: a -> Option[b] \ ef2, iter: Iterator[a, ef1, r]): Iterator[b, ef1 + ef2, r]§ SourceReturns an iterator with every element of the iterator iter that
produces Some(_) the from the function f.
Does not consume any elements from the iterator.
The original iterator iter should not be reused.
def flatMap(f: a -> Iterator[b, ef2, r] \ ef3, ma: Iterator[a, ef1, r]): Iterator[b, r + ef1 + ef2 + ef3, r] \ r§ SourceReturns the result of applying f to every element in iter and concatenating the results.
Does not consume any elements from the iterator.
Currently f has to generate an iterator with region r.
Returns the concatenation of the nested iterators in iter.
Does not consume any elements from the iterator.
The original iterator iter should not be reused.
Applies f to a start value s and all elements in iter going from left to right.
That is, the result is of the form: f(...f(f(s, x1), x2)..., xn).
Consumes the entire iterator.
Returns the result of mapping each element and combining the results.
Applies f to a start value s and all elements in iter going from right to left.
That is, the result is of the form: f(x1, ...f(xn-1, f(xn, s))...).
Consumes the entire iterator.
Applies f to every element of iter.
Consumes the entire iterator.
def forEachWithIndex(f: Int32 -> (a -> Unit \ ef2), iter: Iterator[a, ef1, r]): Unit \ ef1 + ef2 + r§ SourceApplies f to every element of iter along with that element's index.
Consumes the entire iterator.
def intercalate(sep: t[a], iter: Iterator[Iterator[a, ef, r], ef, r]): Iterator[a, ef + r, r] \ r + Aef[t] with Foldable[t]§ SourceReturns the concatenation of the elements in iter with the elements of sep inserted between every two adjacent elements.
That is, returns b1 :: a1 ... an :: b2 :: ... bn-1 :: a1 :: ... :: an :: bn :: Nil.
Does not consume any elements from either iterator.
The original iterators sep and iter should not be reused.
Returns an iterator with a inserted between every of iter.
Does not consume any elements from the iterator.
Build an iterator by applying f to the initial value x.
f should return Some(a1) to signal a new element a1 (which also becomes the next input to f).
f should return None to signal the end of the iterator.
Returns the concatenation of the string representation
of each element in iter with sep inserted between each element.
Consumes the entire iterator.
def joinWith(f: a -> String \ ef2, sep: String, iter: Iterator[a, ef1, r]): String \ ef1 + ef2 + r§ SourceReturns the concatenation of the string representation
of each element in iter according to f with sep inserted between each element.
Consumes the entire iterator.
Returns an iterator with every f lazily applied to each element in iter.
Does not consume any elements from the iterator.
def mapWithIndex(f: Int32 -> (a -> b \ ef2), iter: Iterator[a, ef1, r]): Iterator[b, ef1 + ef2, r] \ r§ SourceReturns an iterator with every f lazily applied to each element in iter
together with its index.
Does not consume any elements from the iterator.
Returns Some(x) if iter is not empty. Returns None otherwise.
Consumes the head element of iter.
Returns an iterator of all integers between b (inclusive) and e (exclusive).
Returns an empty iterator if b >= e.
def reduceLeft(f: a -> (a -> a \ ef2), iter: Iterator[a, ef1, r]): Option[a] \ ef1 + ef2 + r§ SourceApplies f to all elements in iter going from left to right until a single value v is obtained. Returns Some(v).
That is, the result is of the form: Some(f(...f(f(x1, x2), x3)..., xn))
Returns None if iter is empty.
Consumes the entire iterator.
Returns an iterator over an iterable with the element x repeated n times.
Returns an empty iterator if n < 0.
def replace(src: { src = a }, dst: { dst = a }, iter: Iterator[a, ef, r]): Iterator[a, ef, r] with Eq[a]§ SourceReturns an iterator with every occurrence of src replaced by dst in iter.
Does not consume any elements from the iterator.
Returns an iterator containing only a single element, x.
Returns the sum of all elements in the iterator iter.
Consumes the entire iterator.
Returns the sum of all elements in the iterator iter according to the function f.
Consumes the entire iterator.
Returns iter with the first n elements.
Returns iter if n is larger than the number of elements in iter.
Returns an empty iterator if n < 0.
Does not consume any elements from the iterator.
The original iterator iter should not be reused.
Returns the longest prefix of iter that satisfies the predicate f.
Does not consume any elements from the iterator.
The original iterator iter should not be reused.
Returns the contents of iter as an array.
Consumes the entire iterator.
Returns the contents of iter as a chain.
Consumes the entire iterator.
Returns the contents of iter as a list.
Consumes the entire iterator.
Returns the contents of iter as a map.
Consumes the entire iterator.
Returns the contents of iter as a Nec.
Consumes the entire iterator.
Returns the contents of iter as a Some(Nel) if iter is not empty. Returns None otherwise.
Consumes the entire iterator.
Returns the contents of iter as a set. Consumes the entire iterator.
Returns the contents of iter as an array.
Consumes the entire iterator.
Build an iterator by applying f to the seed value st.
f should return Some(a, st1) to signal a new element a and a new seed value st1.
f should return None to signal the end of the iterator.
Returns an iterator built with the stepper function f.
f is expected to encapsulate a stateful resource.
f should return Some(a) to signal a new element a.
f should return None to signal the end of the iterator.
Returns an iterator over the results of f.
If f returns Ok(x), then the next element is x.
If f returns Err(e), then the iterator is depleted.
def zip(iterA: Iterator[a, ef1, r1], iterB: Iterator[b, ef2, r2]): Iterator[(a, b), r2 + ef1 + ef2, r1]§ SourceReturns an iterator where the element at index i is (a, b) where
a is the element at index i in iterA and b is the element at index i in iterB.
Does not consume any elements from either iterator.
If either iterA or iterB is depleted, then no further elements are added to the resulting iterator.
The original iterators iterA and iterB should not be reused.
An iterator should never be zipped with itself.
def zipWith(f: a -> (b -> c \ ef3), iterA: Iterator[a, ef1, r1], iterB: Iterator[b, ef2, r2]): Iterator[c, r2 + ef1 + ef2 + ef3, r1]§ SourceReturns an iterator where the element at index i is f(a, b) where
a is the element at index i in iterA and b is the element at index i in iterB.
Does not consume any elements from either iterator.
If either iterA or iterB becomes depleted, then no further elements are added to the resulting list.
The original iterators iterA and iterB should not be reused.
An iterator should never be zipped with itself.