PipeTo v0.1.1 PipeTo

Summary

Functions

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

Macros

PipeTo operator

Functions

unpipe(expr)

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}]

Macros

left ~> right

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]