I am afraid I do not get the message José, did you mean that 
`Stream.map(enum, &(&1))` is an antipattern?
Well my use case is very simple, I have a list and I want to make it lazy, 
why should I not use an idiom like the above?
IIUC I should not use Stream at all for this, right? But is there a 
different way? There is no Enum.to_stream for example.

Hmm maybe Stream and List do not play in the same class as Stream does not 
implement Collectable either?

Can you help me out with this, please
Robert

On Wednesday, July 24, 2024 at 12:17:22 AM UTC+2 José Valim wrote:

> While some functions in the Stream module may return the `Stream` struct,
> you must never explicitly check for the `Stream` struct, as streams
> may come in several shapes, such as `IO.Stream`, `File.Stream`, or
> even `Range`s.
>
> The functions in the Stream module only guarantee to return enumerables
> and their implementation (structs, anonymous functions, etc) may
> change at any time. For example, a function that returns an anonymous
> function today may return a struct in future releases.
>
> Instead of checking for a particular type, you must instead write
> assertive code that assumes you have an enumerable, using the functions
> in the `Enume` or `Stream` module accordingly.
>

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/ec510286-01bc-4203-9cdd-9ce4a7c299acn%40googlegroups.com.

Reply via email to