Elixir: error when piping to a function the result of inline comprehension
问题 I've noticed something surprising with Elixir's for comprehensions when used to pipe the results into a function. For example, these forms work: foo = fn(list) -> for n <- list do n + 1 end |> Enum.reverse end foo.([1,2,3]) # [4, 3, 2] foo = fn(list) -> for(n <- list, do: (n + 1)) |> Enum.reverse end foo.([1,2,3]) # [4, 3, 2] But this doesn't, as it considers the |> Mod.func on the second line part of the do block of the macro: foo = fn(list) -> for n <- list, do: n + 1 |> Enum.reverse end