PipeTo v0.2.1 PipeTo View Source

Link to this section Summary

Functions

PipeTo operator.

Breaks a pipeline expression into a list. This is where the target position being calculated.

Link to this section Functions

PipeTo operator.

This operator will replace the placeholder argument _ in the right-hand side function call with left-hand side expression.

Examples

  iex> 1 ~> Enum.at(1..3, _)
  2

It can mix with |> operation

Examples

  iex> 1 ~> Enum.at(1..3, _) |> Kernel.*(5)
  10

When using ~> withou placeholder _, it act just like |> pipe operator.

Examples

  iex> [1, 2, 3] ~> Enum.take(2)
  [1, 2]

Specs

unpipe(Macro.t()) :: [Macro.t()]

Breaks a pipeline expression into a list. This is where the target position being calculated.

    PipeTo.unpipe(quote do: 5 ~> div(100, _) ~> div(2))
    # => [{5, 0},
    #     {{:div, [context: Elixir, import: Kernel], 'd'}, 1},
    #     {{:div, [], [2]}, 0}]