WLJS LogoWLJS Notebook

Composition

Composition[f, g, h] represents the composition of functions, applied right to left: f[g[h[x]]].

Examples

Compose functions:

(* f[g[x]] *)
comp = Composition[Sqrt, Abs]
comp[-4]
(* 2 *)

(* Chain multiple functions *)
Composition[Length, Flatten, Table][i, {i, 3}, {j, i}]
(* 6 *)

(* Using @* operator *)
(Sqrt @* Abs)[-9]
(* 3 *)

Please visit the official Wolfram Language Reference for more details.

On this page