Functionals
In contrast to primitive functions, functionals operate on other functions. For example, some functions have a unit value, such as 0 for addition and 1 for multiplication. The functional unit produces such a value when applied to a function f that has one:
unit + = 0 unit × = 1 unit foo = ⊥These are the core functionals of FP:
composition f°g where f°g:x = f:(g:x) construction where :x = 〈f1:x,...,fn:x〉 condition (h ⇒ f;g) where (h ⇒ f;g):x = f:x if h:x = T = g:x if h:x = F = ⊥ otherwise apply-to-all αf where αf:〈x1,...,xn〉 = 〈f:x1,...,f:xn〉 insert-right /f where /f:〈x〉 = x and /f:〈x1,x2,...,xn〉 = f:〈x1,/f:〈x2,...,xn〉〉 and /f:〈 〉 = unit f insert-left \f where \f:〈x〉 = x and \f:〈x1,x2,...,xn〉 = f:〈\f:〈x1,...,xn-1〉,xn〉 and \f:〈 〉 = unit fRead more about this topic: FP (programming Language)