Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

Import Rust iterator methods into this library #32

Open
Hywan opened this issue Dec 21, 2016 · 0 comments
Open

Import Rust iterator methods into this library #32

Hywan opened this issue Dec 21, 2016 · 0 comments

Comments

@Hywan
Copy link
Member

Hywan commented Dec 21, 2016

For instance:

$any = (new Iterator\Map($data)).any(function ($item) { return 0 === $item % 2; })

instead of:

$any = false;

foreach ($data as $datum) {
    if (0 === $item % 2) {
        $any = true;

        break;
    }
}

The first is less error-prone, normally bug-free, and easier to read. We can optimise it a lot too.

See the Rust iterator API: https://doc.rust-lang.org/std/iter/trait.Iterator.html.
We should benchmark results with manual implementation vs. iterator_apply.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

1 participant