It has been fixed in master. On Saturday, September 10, 2016 at 4:43:02 PM UTC+2, José Valim wrote: > > Hi Paul, > > You got the bug backwards. The issue is that flat_map continues even after > take(1). Streams are by design meant to halt when items will no longer be > consumed. > > I will investigate it soon. > > PS: I will send an email that retires this mailing list later today. > > On Saturday, September 10, 2016, Paul Balomiri <paulbalom...@gmail.com> > wrote: > >> Hi, >> >> Today i banged my head against this one : >> >> iex(13)> [[true,false],[false],[true]]|>Stream.filter(fn([x|tail])-> >> IO.inspect([filter: x]); x end) |>Stream.take(1) |> Stream.flat_map(fn(x)-> >> IO.inspect([flat_map: x]); x end) |> Enum.to_list() >> [filter: true] >> [flat_map: [true, false]] >> [filter: false] >> [filter: true] >> [true, false] >> >> >> taking away the culprit `Stream.flat_map` prevents the execution of >> `Stream.filter`'s function after the first element: >> [[true,false],[false],[true]]|>Stream.filter(fn([x|tail])-> >> IO.inspect([filter: x]); x end) |>Stream.take(1) |> Enum.to_list() >> [filter: true] >> [[true, false]] >> >> It seems to me that this is a bug, but what i find more puzzling is that >> i do not know how `Stream.flat_map` has even any influence on the >> `Stream.filter` function. >> >> Did i miss here how `Stream.flat_map` should work or shall file a bug >> request? >> >> Paul >> >> -- >> You received this message because you are subscribed to the Google Groups >> "elixir-lang-talk" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to elixir-lang-talk+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/elixir-lang-talk/ed614aa7-8c44-490d-90d4-7ff563dc9dc9%40googlegroups.com >> >> <https://groups.google.com/d/msgid/elixir-lang-talk/ed614aa7-8c44-490d-90d4-7ff563dc9dc9%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > > -- > > > *José Valim* > www.plataformatec.com.br > Skype: jv.ptec > Founder and Director of R&D > >
-- You received this message because you are subscribed to the Google Groups "elixir-lang-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-talk+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-talk/f87ded9b-4be3-451e-92b4-bd39bfd5a4e2%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.