HOME

TheInfoList



OR:

FP (short for ''functional programming'') is a
programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
created by
John Backus John Warner Backus (December 3, 1924 – March 17, 2007) was an American computer scientist. He directed the team that invented and implemented FORTRAN, the first widely used high-level programming language, and was the inventor of the Backu ...
to support the
function-level programming In computer science, function-level programming refers to one of the two contrasting programming paradigms identified by John Backus in his work on programs as mathematical objects, the other being value-level programming. In his 1977 Turing A ...
paradigm. It allows building programs from a set of generally useful primitives and avoiding named variables (a style also called tacit programming or "point free"). It was heavily influenced by APL which was developed by Kenneth E. Iverson in the early 1960s. The FP language was introduced in Backus's 1977
Turing Award The ACM A. M. Turing Award is an annual prize given by the Association for Computing Machinery (ACM) for contributions of lasting and major technical importance to computer science. It is generally recognized as the highest distinction in comput ...
paper, "Can Programming Be Liberated from the von Neumann Style?", subtitled "a functional style and its algebra of programs." The paper sparked interest in functional programming research, eventually leading to modern functional languages, which are largely founded on the
lambda calculus Lambda calculus (also written as ''λ''-calculus) is a formal system in mathematical logic for expressing computation based on function abstraction and application using variable binding and substitution. It is a universal model of computation th ...
paradigm, and not the function-level paradigm Backus had hoped. In his Turing award paper, Backus described how the FP style is different: FP itself never found much use outside of academia. In the 1980s Backus created a successor language, FL, which was an internal project at IBM Research.


Overview

The values that FP programs map into one another comprise a set which is
closed Closed may refer to: Mathematics * Closure (mathematics), a set, along with operations, for which applying those operations on members always results in a member of the set * Closed set, a set which contains all its limit points * Closed interval, ...
under sequence formation: if x1,...,xn are values, then the sequence 〈x1,...,xn〉 is also a value These values can be built from any set of atoms: booleans, integers, reals, characters, etc.: boolean : integer : character : symbol : ⊥ is the undefined value, or bottom. Sequences are ''bottom-preserving'': 〈x1,...,⊥,...,xn〉 = ⊥ FP programs are ''functions'' f that each map a single ''value'' x into another: f:x represents the value that results from applying the function f to the value x 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 primitive function is constant, which transforms a value x into the constant-valued function x̄. Functions are strict: f:⊥ = ⊥ Another example of a primitive function is the selector function family, denoted by 1,2,... where: ''i'':〈x1,...,xn〉 = xi if 1 ≤ ''i'' ≤ n = ⊥ otherwise


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 ''f1,...,fnwhere ''f1,...,fnx = 〈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 f


Equational functions

In addition to being constructed from primitives by functionals, a function may be defined recursively by an equation, the simplest kind being: f ≡ ''E''f where ''E''f is an
expression Expression may refer to: Linguistics * Expression (linguistics), a word, phrase, or sentence * Fixed expression, a form of words with a specific meaning * Idiom, a type of fixed expression * Metaphorical expression, a particular word, phrase, ...
built from primitives, other defined functions, and the function symbol f itself, using functionals.


FP84

FP84 is an extension of FP to include
infinite sequence In mathematics, a sequence is an enumerated collection of objects in which repetitions are allowed and order matters. Like a set, it contains members (also called ''elements'', or ''terms''). The number of elements (possibly infinite) is calle ...
s, programmer-defined
combining form Neoclassical compounds are compound words composed from combining forms (which act as affixes or stems) derived from classical Latin or ancient Greek roots. New Latin comprises many such words and is a substantial component of the technical an ...
s (analogous to those that Backus himself added to FL, his successor to FP), and
lazy evaluation In programming language theory, lazy evaluation, or call-by-need, is an evaluation strategy which delays the evaluation of an expression until its value is needed ( non-strict evaluation) and which also avoids repeated evaluations (sharing). The ...
. Unlike FFP, another one of Backus' own variations on FP, FP84 makes a clear distinction between objects and functions: i.e., the latter are no longer represented by sequences of the former. FP84's extensions are accomplished by removing the FP restriction that sequence construction be applied only to ''non''-⊥ objects: in FP84 the entire universe of expressions (including those whose meaning is ⊥) is
closed under In mathematics, a subset of a given set is closed under an operation of the larger set if performing that operation on members of the subset always produces a member of that subset. For example, the natural numbers are closed under addition, but ...
sequence construction. FP84's semantics are embodied in an underlying algebra of programs, a set of function-level equalities that may be used to manipulate and reason about programs.


References

{{Reflist, refs= {{Cite journal , doi = 10.1145/359576.359579, title = Can programming be liberated from the von Neumann style?: A functional style and its algebra of programs, journal = Communications of the ACM, volume = 21, issue = 8, pages = 613, year = 1978, last1 = Backus , first1 = J. , doi-access = free {{cite web , title=Association for Computing Machinery A. M. Turing Award , url=http://signallake.com/innovation/JBackus032007.pdf *''Sacrificing simplicity for convenience: Where do you draw the line?'', John H. Williams and Edward L. Wimmers, IBM Almaden Research Center, Proceedings of the FIfteenth Annual ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages, San Diego, CA, January 1988.


External links


Interactive FP
(requires Java)


FP-Interpreter
written in Delphi/Lazarus
Dirk Gerrits: Turing Award lecture (1977-1978) ff
in John W. Backus (Publications) * FP84 vs FL
Sacrificing simplicity for convenience: Where do you draw the line?
J.H. William and E.L. Wimmers, 1988 (Pages 169–179) Academic programming languages Function-level languages Programming languages created in 1977