pipe

Composes passed-in functions fun[0], fun[1], ... returning a function f(x) that in turn returns ...(fun[1](fun[0](x))).... Each function can be a regular functions, a delegate, a lambda, or a string.

  1. auto ref pipe(Args args)
    template pipe(fun...)
    ref
    static if(fun.length != 1)
    static if(f.length == fun.length && Filter!(_needNary, f).length == 0)
    pipe
    (
    Args...
    )
    (
    auto ref Args args
    )
  2. alias pipe = .pipe!(staticMap!(naryFun, f))
  3. alias pipe = naryFun!(fun[0])

Members

Aliases

f
alias f = staticMap!(_unpipe, fun)
Undocumented in source.
pipe
alias pipe = naryFun!(fun[0])
Undocumented in source.
pipe
alias pipe = .pipe!(staticMap!(naryFun, f))
Undocumented in source.

Functions

pipe
auto ref pipe(Args args)

Examples

assert(pipe!("a + b", a => a * 10)(2, 3) == 50);

pipe can return by reference.

int a;
assert(&pipe!("a", "a")(a) == &a);

Template bloat reduction

enum  a = "a * 2";
alias b = e => e + 2;

alias p0 = pipe!(pipe!(a, b), pipe!(b, a));
alias p1 = pipe!(a, b, b, a);

static assert(__traits(isSame, p0, p1));

Meta