Skip to content

Conversation

josevalim
Copy link
Member

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

José Valim added 16 commits December 11, 2013 15:01
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.
…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
Copy link
Contributor

meh commented Dec 11, 2013

Cool stuff 👍

@batate
Copy link
Contributor

batate commented Dec 11, 2013

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

josevalim pushed a commit that referenced this pull request Dec 12, 2013
Migrate Enumerable to use an iteratees based solution
@josevalim josevalim merged commit cb32338 into master Dec 12, 2013
@josevalim josevalim deleted the jv-iteratees branch December 12, 2013 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants