Jump to content

Total functional programming

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Porges (talk | contribs) at 02:19, 5 June 2007 (created page!). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

Total functional programming (also known as strong functional programming[1], to be contrasted with ordinary, or weak functional programming) is a programming paradigm which restricts the range of programs to those which are provably terminating.

Termination is guaranteed through a restricted form of recursion, which operates only upon ‘reduced’ forms of its arguments. One such form is Walther recursion. In addition, every function must be a total (as opposed to partial) function—i.e. it must have a definition for everything inside its domain. This may lead to unexpected or arbitrary definitions such as

These restrictions mean that total functional programming is not Turing-complete. However, the set of algorithms which can be used is still huge. For example, any algorithm which has had an asymptotic upper bound calculated for it can be trivially transformed into a provably-terminating function by using the upper bound as an extra argument which is decremented upon each iteration or recursion.

Another outcome of total functional programming is that there is no longer a separation between strict evaluation and lazy evaluation.

Total functional programming must necessarily also make a distinction between data and co-data—the former is finitary, which the latter is potentially infinite. Such potentially infinite data structures are needed for applications such as I/O.

Footnotes

  1. ^ This term is due to: Turner, D.A. (December 1995), "First International Symposium on Functional Programming Languages in Education", Springer LNCS, 1022: 1–13 {{citation}}: |contribution= ignored (help); Check date values in: |date= (help).

References

  • Turner, D.A. (2004-07-28), "Total Functional Programming", Journal of Universal Computer Science, 10 (7): 751–768 {{citation}}: Check date values in: |date= (help)