Skip to content
Pipes
Erlang
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md
example.erl
pipe_transform.erl

README.md

pipe-transform

Usage

Pipe transform uses syntax of list comprehension:

[pipe||Arg, ...]

Arg (first element) is passed as is, the rest are transformed into function calls.

Arg and every call result become first argument of the next call:

[pipe||x, fn(y)] => fn(x, y) [pipe||x, fn(y), fn(z)] => fn(fn(x, y), z)

Functions are called from left to right

Supported calls

  • f - local function
  • m:f - external function

Example

-module(foo).
-compile({parse_transform, pipe_transform}).

-export([f/0]).

f()  -> [pipe||1, inc, mul(2)].

inc(X) -> X + 1.

mul(X, K) -> X * K.
You can’t perform that action at this time.