| |||||||||
FP (short for Function Programming) is a programming language created by John Backus to support the Function-level programming paradigm.
The values that FP programs map into one another comprise a set which is closed under sequence formation:
These values can be built from any set of atoms: booleans, integers, reals, characters, etc.:
⊥ is the undefined value, or bottom. Sequences are bottom-preserving:
FP programs are functions f that each map a single value x into another:
Functions are either primitive (i.e., provided with the FP environment) or are built from the primitives by program-forming operations (also called functionals). An example of one such operation is constant, which transforms a value x into the constant-valued function x̄. Functions are strict:
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:
These are the core functionals of FP:
In addition to being constructed from primitives by functionals, a function may be defined recursively by an equation, the simplest kind being:
where E'f is an expression built from primitives, other defined functions, and the function symbol f itself, using functionals.
An example of a primitive function is the selector function family, denoted by 1,2,... where: