Skip to content

add traverse/1 to Stream - #6369

Closed
ckampfe wants to merge 1 commit into
elixir-lang:masterfrom
ckampfe:add-traverse-to-stream
Closed

add traverse/1 to Stream#6369
ckampfe wants to merge 1 commit into
elixir-lang:masterfrom
ckampfe:add-traverse-to-stream

Conversation

@ckampfe

@ckampfe ckampfe commented Jul 22, 2017

Copy link
Copy Markdown
Contributor

This PR adds Stream.traverse/1. See proposal here: https://groups.google.com/forum/#!topic/elixir-lang-core/B5e8mWsQto0

@josevalim

Copy link
Copy Markdown
Member

Your implementation handles only lists and maps, and not all enumerables. A function in Stream would need to consider all enumerables but the issues is, doing so is quite hard, as you can only know if something is an enumerable or not if try to invoke the protocol in it, and that can be potentially quite expensive.

So it is likely this is better implemented in your application with the constraints that make sense for your application, rather than in Elixir.

In any case, thanks for the PR!

@josevalim josevalim closed this Jul 22, 2017
@ckampfe

ckampfe commented Jul 22, 2017

Copy link
Copy Markdown
Contributor Author

Makes sense, thank you!

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.

2 participants