Function Composition
Function composition refers to the "gluing" together of two functions using a dyadic operator such that the functions are applied to the argument(s) as normal, but in a particular pattern specific to the operator that is being used. The term function composition comes from traditional mathematics, where it is used for a function h(x)=f(g(x))
when written as h(x)=(f∘g)(x)
APL generalises this idea to dyadic functions, allowing various patterns of application in addition to the simple application of one monadic function to the result of another monadic function. The four main patterns, represented by atop, behind, beside, and over, can be visualised as shown below.
Information
In the diagrams below, the dotted branch falls away when the operator is applied monadically. Note that monadic atop, beside, and over are all equivalent to each other and to h(x)=(f∘g)(x)
of traditional mathematics.
Atop: {R}←{X}f⍤g Y
Behind: {R}←{X}f⍛g Y
Beside: {R}←{X}f∘g Y
Over: {R}←{X}f⍥g Y