[Proposal] Option to generate stream from `for`

36 de afișări
Accesați primul mesaj necitit

luk...@niemier.pl

necitită,
22 iul. 2021, 06:56:1322.07.2021
– elixir-lang-core
Currently, while there is `:into` option in `for`, there is no way to make it into "regular" stream. It would be handy to have a way to either make something like:

```
for a <- 1..10, b <- 1..10, into: Stream, do: {a, b}
```

Or have additional option:

```
for a <- 1..10, b <- 1..10, stream: true, do: {a, b}
```

That would make `for` to return stream. This can be handy in cases where resulted list would be so huge, that it would start to be problematic for VM to catch up.

José Valim

necitită,
22 iul. 2021, 08:02:3422.07.2021
– elixir-l...@googlegroups.com
"into: Stream" plays well with the current semantics where "into: ..." changes the return value however, because emitting a stream would require "for" to emit a completely different code than today, "into: Stream" would only work if the Stream module is given at compilation time. In a nutshell, this is welcome, but it is a relatively high amount of work.



--
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-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/671c053f-359e-4b35-b696-4e262de30583n%40googlegroups.com.
Răspundeți tuturor
Răspundeți autorului
Redirecționați
0 mesaje noi