PLDB
Languages Features Creators Calendar CSV Resources Blog About Donate Add Language
GitHub icon

Function Composition

< >
function o(f, g) { return function(x) { return f(g(x)); } }
Example from C#:
// Call example: // var c = Compose(f, g); // // Func<int, bool> g = _ => ... // Func<bool, string> f = _ => ... Func<TIn, TOut> Compose<TIn, TMid, TOut>(Func<TMid, TOut> f, Func<TIn, TMid> g) => _ => f(g(_));
Example from Haskell:
foo = f . g
Example from APL:
foo←f∘g
Example from Coconut:
(f..g..h)(x, y, z)
Example from Raku:
my &foo = &f ∘ &g;
Example from fp:
/+∘α(bu + 1):<1,2,3,4,5,6,7,8,9,10>

Languages with Function Composition include JavaScript, C#, Haskell, TypeScript, APL, Coconut, Raku, fp, Static Typescript

Languages without Function Composition include C3

Read more about Function Composition on the web: 1.

HTML of this page generated by Features.ts

hasForLoops.html · hasFunctionComposition.html · hasFunctionOverloading.html

View source

PLDB - Build the next great programming language · Search · v2023 · Day 157 · Docs · Acknowledgements · Traffic Today · Traffic Trends · Mirrors · GitHub · feedback@pldb.com