New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate Enumerable to use an iteratees based solution #1922

Merged
merged 16 commits into from Dec 12, 2013

Conversation

Projects
None yet
3 participants
@josevalim
Member

josevalim commented Dec 11, 2013

This pull request migrates the Enumerable protocol to use a solution based on iteratees. This allow us to halt enumeration (cleaning up the implementation of functions like take/2 and drop/2) and also adds the possibility of interleaving enumerables via suspend. To show case the new functionalities we got, this pull request considerably extends the Stream API, by adding functions like zip/2, chunks/4 and more. More info can be found in the updated documentation for Enumerable. @pminten is also working on a blog post that explains the underlying mechanisms quite well.

On the negative side, this pull request does backwards incompatible changes on how the Enumerable protocol works. For this reason, the next Elixir release will be tagged 0.12.0 (to be released this weekend).

Huge thanks to @jessitron for pairing with me on the initial implementation of iteratees. Feedback is welcome!

/cc @ericmj @pminten @devinus @meh

josevalim added some commits Dec 9, 2013

Convert to new iteratee-based enumeration
Details are described in the Enumerable docs.
This new implementation allows us to implement interleaving
functions (like zip) while avoiding a huge penalty in regular
enumeration.
Change Enumerable.count/1 and Enumerable.member?/2 to return tagged t…
…uples

The motivation behind this change is to not force every application
to implement count/1 and member?/2 manually. It also allows us in
the future to add functions like Enum.counted?/1 that will return
true if count is pre-calculated.
@meh

This comment has been minimized.

Show comment
Hide comment
@meh

meh Dec 11, 2013

Contributor

Cool stuff 👍

Contributor

meh commented Dec 11, 2013

Cool stuff 👍

@batate

This comment has been minimized.

Show comment
Hide comment
@batate

batate Dec 11, 2013

Awesome work, josevalim. This will open a lot of doors.

batate commented Dec 11, 2013

Awesome work, josevalim. This will open a lot of doors.

josevalim added a commit that referenced this pull request Dec 12, 2013

Merge pull request #1922 from elixir-lang/jv-iteratees
Migrate Enumerable to use an iteratees based solution

@josevalim josevalim merged commit cb32338 into master Dec 12, 2013

1 check passed

default The Travis CI build passed
Details

@josevalim josevalim deleted the jv-iteratees branch Dec 12, 2013

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