Science  People  Locations  Timeline
Index: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Home > Functional programming


 Contents
Functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions.

In contrast to imperative programming, functional programming 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.

1 Introduction

Mathematical functions have great strengths in terms of flexibility and 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 function in this sense has zero or more parameters and a single return value. The parameters—or arguments, as they are sometimes called—are the inputs to the function, and the return value is the function's output. The definition of a function describes how the function is to be evaluated in terms of other functions. For example, the function f(x) = x2 + 2 is defined in terms of the power and addition functions. At some point, the language has to provide basic functions that require no further definition.

Functions can be manipulated in a variety of ways in a functional programming language. Functions are treated as first-class values, which is to say that functions can be parameters or inputs to other functions and can be the return values or outputs of a function. This allows functions like mapcar in LISP and map in Haskell that take both a function and a list as input and apply the input function to every element of the list. Functions can be named, as in other languages, or defined anonymously (sometimes during program execution) using a lambda abstraction and used as values in other functions. Functional languages also allow functions to be "curried". Currying is a technique for rewriting a function with multiple parameters as the composition of functions of one parameter. The curried function can be applied to just a subset of its parameters. The result is a function where the parameters in this subset are now fixed as constants, and the values of the rest of the parameters are still unspecified. This new function can be applied to the remaining parameters to get the final function value. For example, a function add(x,y) = x + y can be curried so that the return value of add(2)—notice that there is no y parameter—will be an anonymous function that is equivalent to a function add2(y) = 2 + y. This new function has only one parameter and corresponds to adding 2 to a number. Again, this is possible only because functions are treated as first-class values.

2 History

Lambda calculus could be considered the first functional programming language, though it was not designed to be executed on a computer. Lambda calculus is a model of computation designed by Alonzo Church in the 1930s that provides a very formal way to describe function evaluation. The first computer-based functional programming language was Information Processing LanguageInformation Processing Language (IPL) was a programming language developed by Allen Newell, Cliff Shaw and Herbert Simon at RAND Corporation and the Carnegie Institute of Technology from about 1956. It included features intended to support programs that c (IPL), developed by Newell, Shaw, and Simon at RAND Corporation for the JOHNNIACThe JOHNNIAC or John (v. N eumann) I ntegrator and A utomatic C omputer an early computer built by RAND, was based on the Institute for Advanced Study (IAS) architecture developed by John von Neumann and named in his honor. As with all computers of its er computer in the mid 1950sCenturies: 19th century 20th century 21st century Decades: 1900s 1910s 1920s 1930s 1940s 1950s 1960s 1970s 1980s 1990s 2000s Years: 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 Events and trends Technology United States tests the first fusion bomb.. A much-improved functional programming language was LISP, developed by John McCarthyComputer scientist, inventor of the term " artificial intelligence" and much more. See John McCarthy (computer scientist) British journalist, kidnapped by terrorists in Lebanon during the late 1980s. See John McCarthy (journalist) Linguist, phonologist. while at the Massachusetts Institute of TechnologyMotto Mens et Manus ("mind and hand") Established 1861 School type Private President Charles Vest (successor Susan Hockfield to take office in December 2004) Location Cambridge, Mass. USA Enrollment 4,112 undergraduate, 6,228 graduate Faculty 974 Campus U for the IBM 700/7000 seriesThe IBM 700/7000 series was a series of incompatible large scale ( mainframe) computer systems made by IBM through the 1950s and early 1960s. The 700's were all made obsolete by the introduction of the 7000s. The 7000s, in turn, were eventually replaced b scientific computers in the late 1950sCenturies: 19th century 20th century 21st century Decades: 1900s 1910s 1920s 1930s 1940s 1950s 1960s 1970s 1980s 1990s 2000s Years: 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 Events and trends Technology United States tests the first fusion bomb.. While not a purely functional programming language, LISP did introduce most of the features now found in modern functional programming languages. Scheme was a later attempt to simplify and improve LISP. In the 1970s the language ML was created at the University of Edinburgh, and David Turner developed the language Miranda at the University of Kent. The language Haskell was released in the late 1980s in an attempt to gather together many ideas in functional programming research.

Read more »

Non User