compose

Compose two Functions.

  1. class ComposedFunction(A, B, C, D)
  2. auto compose(F f, G g)
    compose
    (
    F
    G
    )
    (
    F f
    ,
    G g
    )
    if (
    is(F : Function!(F.InputType, F.OutputType)) &&
    is(G : Function!(G.InputType, G.OutputType))
    &&
    is(F.OutputType : G.InputType)
    )

Examples

auto f = RealFunction!(triple!int).get.compose(RealFunction!(increment!int).get);
auto g = RealFunction!(increment!int).get.compose(RealFunction!(triple!int).get);
assert (f(0) == 1);
assert (f(1) == 4);
assert (g(0) == 3);
assert (g(1) == 6);

Meta