3
私はこの作業の理由を理解トラブルを抱えている:エリクサーパイプ無効な構文
1..1000 |> Stream.map(&(3 * &1)) |> Enum.sum
このdoesntの間:
が唯一の違いは、私の理解に.map
、エリクサーSHOULDの後にスペースですこの場合は空白を気にしないでください。 iex
で上記のコードを実行する
は、次のエラーが得られます。
warning: you are piping into a function call without parentheses, which may be ambiguous. Please wrap the function you are piping into in parentheses. For example:
foo 1 |> bar 2 |> baz 3
Should be written as:
** (FunctionClauseError) no function clause matching in Enumerable.Function.reduce/3
foo(1) |> bar(2) |> baz(3)
(elixir) lib/enum.ex:2776: Enumerable.Function.reduce(#Function<6.54118792/1 in :erl_eval.expr/5>, {:cont, 0}, #Function<44.12486327/2 in Enum.reduce/3>)
(elixir) lib/enum.ex:1486: Enum.reduce/3
はなぜパイプ演算子は、ここでは2例の区別をしていますか?
おかげさまで、まったくそのようなことは期待していなかった:)非常に良い説明! –