Jump to content

Functional programming

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 203.37.81.xxx (talk) at 13:58, 14 October 2001 ("often" in front of recursion; higher order functions.). 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)

Functional programming is a style of programming that emphasizes the evaluation of functional expressions, rather than execution of commands. The expressions in these languages are formed by using functions to combine basic values.

The functions alluded to in the title are mathematical functions. Mathematical functions have great strengths in terms of flexibility and in terms of analysis. For example if a function is known to be idempotent, then a call to a function which has itself as its argument, and which is known to have no side effects, may be efficiently computed without multiple calls.

A functional programming language is a language that supports and encourages programming in a functional style.

Functional programming often depends heavily on recursion. The Scheme programming language even requires certain types of recursion (tail recursion) to be recognized and automatically eliminated by a compiler.

A powerful mechanism sometimes used in functional programming, is the notion of higher-order functions. That is, functions that can take functions as arguments, and/or return functions as results.

Functional programming language implementations are usually more sophisticated about stack manipulation, since it is used so commonly.

Chapter 4 - Functional Programming - of Raphael Finkel's Advanced Programming Language Design is an excellent introduction to and explanation of functional programming. Here's a link to the chapter, and here's AddisonWesley's page for the book