Skip to content

Accessibility of Splitter.remaining #218

Description

@mbovel

Hi,

Scala parallel collections docs and MOOC mention a .remaining method on Splitter and a .splitter method on collections returning a Splitter:

* All of the parallel operations are implemented as tasks within this trait. Tasks rely
* on the concept of splitters, which extend iterators. Every parallel collection defines:
*
* {{{
* def splitter: IterableSplitter[T]
* }}}
*
* which returns an instance of `IterableSplitter[T]`, which is a subtype of `Splitter[T]`.
* Splitters have a method `remaining` to check the remaining number of elements,
* and method `split` which is defined by splitters. Method `split` divides the splitters
* iterate over into disjunct subsets:

In practice, .remaining is actually defined on IterableSplitter:

And the .splitter method is package-private:

protected[parallel] def splitter: IterableSplitter[T]

Why is that?

Is there a way to obtain an IterableSplitter from a collection using the public API?

In particular, a slide of the MOOC suggests this implementation of .fold on a Splitter:

image

How could I use it in practice, say on a ParVector?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions