Skip to content

Unexpected interaction between Stream.concat, Stream.take, and Stream.transform #5763

@4xrsJCr9

Description

@4xrsJCr9
% iex
Erlang/OTP 19 [erts-8.2] [source-fbd2db2] [64-bit] [smp:2:2] [async-threads:10] [hipe] [kernel-poll:false]

Interactive Elixir (1.4.0) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> [1] |> Stream.concat([2]) |> Stream.take(1) |> Stream.transform(0, fn e, a -> {[e], a} end) |> Enum.to_list
[1]
iex(2)> [1] |> Stream.take(1) |> Stream.concat([2]) |> Stream.transform(0, fn e, a -> {[e], a} end) |> Enum.to_list
** (TryClauseError) no try clause matching: {:suspended, [2, 1], #Function<20.36862645/1 in Stream.do_list_transform/9>}
    (elixir) lib/stream.ex:784: Stream.do_transform/8
    (elixir) lib/enum.ex:1776: Enum.reverse/2
    (elixir) lib/enum.ex:2528: Enum.to_list/1
iex(2)>

Environment

Elixir 1.4.0
Linux 3.13.0-85-generic #129-Ubuntu SMP x86_64 GNU/Linux

Current behavior

The second expression (iex(2)) raises an error.

Expected behavior

The result of the second expression (iex(2)) should be the same as that of the first expression (iex(1)) [1, 2].

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions