Joan Venge Joan Venge - 4 months ago 15
C# Question

Does C# support function composition?

In the latest version of C#, can I do something like this?

I feel like linq is the closest but that's chaining, not function composition, right?


I did not let the compiler check this, but this should be possible:

Func<T3,T1> my_chain(Func<T2,T1> f1, Func<T3,T2> f2)
    return (x=> f2(f1(x)));