ArticleslgStudy

mathematics

FP (programming language)

FP (programming language) is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand FP (programming language) rather than just read about it. In short: FP (for functional programming) is a programming language created by John Backus to support the function-level programming paradigm. It allows building programs from a set of generally useful language primitives and avoiding named variables (a style also called tacit programming or "point free").

Key takeaways

  • FP (programming language) belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect FP (programming language) to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of FP (programming language) from memory before moving on to harder problems.

Reference excerpt

FP (for functional programming) is a programming language created by John Backus to support the function-level programming paradigm. It allows building programs from a set of generally useful language primitives and avoiding named variables (a style also called tacit programming or "point free"). It was heavily influenced by APL developed by Kenneth E. Iverson in the early 1960s. The FP language was introduced in Backus's 1977 Turing Award paper, "Can programming be liberated from the von Neumann style?: 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 paradigm, and not the function-level paradigm Backus had hoped. In his Turing award paper, Backus described how the FP style is different:

An FP system is based on the use of a fixed set of combining forms called functional forms. These, plus simple definitions, are the only means of building new functions from existing ones; they use no variables or substitutions rules, and they become the operations of an associated algebra of programs. All the functions of an FP system are of one type: they map objects onto objects and always take a single argument. FP was used little beyond academia. In the 1980s, Backus created a successor language, FL, as an internal project at IBM Research.

Overview The values that FP programs map into one another comprise a set which is closed 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 : {T, F} integer : {0,1,2,...,∞} character : {'a','b','c',...} symbol : {x,y,...}

⊥ 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,...,fn] where [f1,...,fn]: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 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 ≡ Ef

where Ef is an expression built from primitives, other defined functions, and the function symbol f alone, using functionals.

FP84 FP84 is an extension of FP to include infinite sequences, programmer-defined combining forms (analogous to those that Backus added to FL, his successor to FP), and lazy evaluation. 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 enabled by removing the FP restriction that sequence construction be applied to only non-⊥ objects: in FP84 the entire universe of expressions (including those which meaning is ⊥) is closed under 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

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 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)

Worked examples

Example 1 — a first encounter with FP (programming language)

Start with the simplest possible case. Write down what FP (programming language) claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to FP (programming language) before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about FP (programming language) ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of FP (programming language)

In research
FP (programming language) appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses FP (programming language) in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
FP (programming language) is common in secondary-school and first-year university syllabi. It links to neighbouring topics Academic programming languages, Function-level languages, Programming languages created in 1977, so understanding it makes those chapters shorter.
In everyday life
Look for FP (programming language) outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “FP (programming language)” →

How to study FP (programming language) in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what FP (programming language) means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain FP (programming language) out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is FP (programming language) in simple terms?

FP (for functional programming) is a programming language created by John Backus to support the function-level programming paradigm. It allows building programs from a set of generally useful language primitives and avoiding named variables (a style also called tacit programming or "point free").

Why does FP (programming language) matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study FP (programming language)?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on FP (programming language).

Tags

  • Academic programming languages
  • Function-level languages
  • Programming languages created in 1977

Keep exploring