Collectors #
This module provides consumers that collect the values emitted by an iterator in a data structure. Concretely, the following operations are provided:
IterM.toList, collecting the values in a listIterM.toListRev, collecting the values in a list in reverse order but more efficientlyIterM.toArray, collecting the values in an array
If this relation is well-founded, then IterM.toArray, IterM.toList and IterM.toListRev are
guaranteed to finish after finitely many steps. If all of the iterator's steps terminate
individually, IterM.toArray is guaranteed to terminate.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Traverses the given iterator and stores the emitted values in an array.
If the iterator is not finite, this function might run forever. The variant
it.ensureTermination.toArray always terminates after finitely many steps.
Equations
- it.toArray = Std.IterM.toArray.go it #[]
Instances For
Traverses the given iterator and stores the emitted values in an array.
This function is deprecated. Instead of it.allowNontermination.toArray, use it.toArray.
Instances For
Traverses the given iterator and stores the emitted values in an array.
This variant terminates after finitely many steps and requires a proof that the iterator is
finite. If such a proof is not available, consider using IterM.toArray.
Instances For
Traverses the given iterator and stores the emitted values in reverse order in a list. Because
lists are prepend-only, this toListRev is usually more efficient that toList.
If the iterator is not finite, this function might run forever. The variant
it.ensureTermination.toListRev always terminates after finitely many steps.
Equations
- it.toListRev = Std.IterM.toListRev.go it []
Instances For
Traverses the given iterator and stores the emitted values in reverse order in a list. Because
lists are prepend-only, this toListRev is usually more efficient that toList.
This function is deprecated. Instead of it.allowNontermination.toListRev, use it.toListRev.
Instances For
Traverses the given iterator and stores the emitted values in reverse order in a list. Because
lists are prepend-only, this toListRev is usually more efficient that toList.
This variant terminates after finitely many steps and requires a proof that the iterator is
finite. If such a proof is not available, consider using IterM.toListRev.
Instances For
Traverses the given iterator and stores the emitted values in a list. Because
lists are prepend-only, toListRev is usually more efficient that toList.
If the iterator is not finite, this function might run forever. The variant
it.ensureTermination.toList always terminates after finitely many steps.
Equations
- it.toList = Array.toList <$> it.toArray
Instances For
Traverses the given iterator and stores the emitted values in a list. Because
lists are prepend-only, toListRev is usually more efficient that toList.
This function is deprecated. Instead of it.allowNontermination.toList, use it.toList.
Instances For
Traverses the given iterator and stores the emitted values in a list. Because
lists are prepend-only, toListRev is usually more efficient that toList.
This variant terminates after finitely many steps and requires a proof that the iterator is
finite. If such a proof is not available, consider using IterM.toList.