Skip to content

Conversation

PragTob
Copy link
Contributor

@PragTob PragTob commented Nov 19, 2024

This is based on trying to clarify/make more obvious a missunderstanding I held until ~yesterday.

Namely I thought that calling an Enum function on a stream would result in the equivalent of Enum.to_list and hence all stream benefits would be forfeit. Yes, it should be clear seeing Enum.take work that this isn't the case, but it's not always so easy.

This turned out wrong as @benwilson512 pointed out eloquently here: https://elixirforum.com/t/why-is-stream-reduce-while-missing/34422/2

Not sure if this is the best place or way to highlight this in the docs, but I thought I'd give it a shot. One could argue that this documentation belongs in the Enum module, but for Stream documentation that module is the primary source - plus it's more about Streams implementation of Enumerable.

This is based on trying to clarify/make more obvious a
missunderstanding I held until ~yesterday.

Namely I thought that calling an `Enum` function on a stream would
result in the equivalent of `Enum.to_list` and hence all stream
benefits would be forfeit. Yes, it should be clear seeing
`Enum.take` work that this isn't the case, but it's not always
so easy.

This turned out wrong as @benwilson512 pointed out eloquently here:
https://elixirforum.com/t/why-is-stream-reduce-while-missing/34422/2

Not sure if this is the best place or way to highlight this in the
docs, but I thought I'd give it a shot. One could argue that this
documentation belongs in the `Enum` module, but for `Stream`
documentation that module is the primary source - plus it's
more about `Stream`s implementation of `Enumerable`.
@PragTob
Copy link
Contributor Author

PragTob commented Nov 19, 2024

Thank you for all your great work! 💚

IMG_20210919_113647_Bokeh

Co-authored-by: José Valim <jose.valim@gmail.com>
@josevalim josevalim merged commit 50619b1 into elixir-lang:main Nov 19, 2024
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

@PragTob PragTob deleted the stream-clarification branch November 19, 2024 18:47
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