This link has been bookmarked by 134 people . It was first bookmarked on 20 Dec 2006, by eliazar.
-
22 Jan 15
-
avoids changing-state
-
mutable data
-
programming is done with expressions
-
In functional code, the output value of a function depends only on the arguments that are input to the function, so calling a function f twice with the same value for an argument x will produce the same result f(x) each time.
-
-
12 Dec 14
-
In functional code, the output value of a function depends only on the arguments that are input to the function, so calling a function f twice with the same value for an argument x will produce the same result f(x) each time.
-
-
30 Aug 14
-
reats computation as the evaluation of mathematical functions
-
declarative programming paradigm
-
done with expressions
-
has its roots in lambda calculus
-
formal system developed in the 1930s to investigate computability,
-
Many functional programming languages can be viewed as elaborations on the lambda calculus
-
imperative programming changes state with commands in the source language,
-
most simple example is the assignment
-
can have side effects that may change the value of program state.
-
Because of this, they lack referential transparency
-
same language expression can result in different values at different times depending on the state of the executing program
-
idespread domain-specific declarative languages like SQL
-
concepts and paradigms are specific to functional programming, and generally foreign to imperative programming
-
Higher-order functions are functions that can either take other functions as arguments or return them as results
-
"higher-order" describes a mathematical concept of functions that operate on other functions,
-
first-class"
-
computer science term
-
entities that have no restriction on their use
-
irst-class functions can appear anywhere
-
arguments to other functions and as their return values
-
other first-class entities like numbers can
-
Higher-order functions enable partial application or currying
-
echnique in which a function is applied to its arguments one at a time
-
each application returning a new function that accepts the next argument.
-
have no side effects
-
useful properties
-
used to optimize the code
-
If the result of a pure expression is not used,
-
can be removed without affecting other expressions.
-
If a pure function is called with arguments that cause no side-effects
-
result is constant with respect to that argument list
-
can enable caching optimizations
-
f there is no data dependency between two pure expressions, then their order can be reversed
-
or they can be performed in parallel
-
f the entire language does not allow side-effects, then any evaluation strategy can be used
-
gives the compiler freedom to reorder or combine the evaluation of expressions
-
most compilers for imperative programming languages detect pure functions
-
perform common-subexpression elimination for pure function calls
-
Some compilers, such as gcc, add extra keywords for a programmer to explicitly mark external functions as pure
-
invoke themselves
-
allowing an operation to be performed over and over until the base case is reached
-
some recursion requires maintaining a stack
-
tail recursion can be recognized and optimized by a compiler into the same code used to implement iteration in imperative languages
-
Such higher order functions play a role analogous to built-in control structures such as loops in imperative languages
-
Most general purpose functional programming languages allow unrestricted recursion and are Turing complete,
-
makes the halting problem undecidable,
-
Functional languages can be categorized by whether they use strict (eager) or non-strict (lazy) evaluation
-
how function arguments are processed when an expression is being evaluated
-
evaluation of any term containing a failing subterm will itself fail
-
strict evaluation always fully evaluates function arguments before invoking the function
-
Lazy evaluation does not evaluate function arguments unless their values are required to evaluate the function call itself
-
First-class functions have slowly been added to mainstream languages
-
-
27 Aug 14
-
that treats computation as the evaluation of mathematical functions and avoids state and mutable data.
-
In contrast, imperative programming changes state with commands in the source language, the most simple example is the assignment.
-
-
10 May 14
-
treats computation as the evaluation of mathematical functions
-
produce results that depend only on their inputs and not on the program state
-
It is a declarative programming paradigm, which means programming is done with expressions. In functional code, the output value of a function depends only on the arguments that are input to the function, so calling a function f twice with the same value for an argument x will produce the same result f(x) both times
-
Java 8 supports lambda expressions as a replacement for some anonymous classes.[48] However, the presence of checked exceptions in Java can make functional programming inconvenient, because it can be necessary to catch checked exceptions and then rethrow them—a problem that does not occur in other JVM languages that do not have checked exceptions, such as Scala
-
09 May 14
-
nikerymFunctional programming http://t.co/ef3hJxNsEl (cmts http://t.co/KC7nkLDR42)
— HN from Y Combinator (@hnycombinator) May 9, 2014
via Instapaper: Unread https://www.instapaper.com/u -
18 Apr 14
-
that treats computation as the evaluation of mathematical functions and avoids state and mutable data.
-
Functional programming emphasizes functions that produce results that depend only on their inputs and not on the program state
-
-
13 Jan 14
-
08 Oct 13
-
20 Sep 13
-
16 Sep 13
-
In computer science, functional programming is a programming paradigm, a style of building the structure and elements of computer programs, that treats computation as the evaluation of mathematical functions and avoids state and mutable data. Functional programming emphasizes functions that produce results that depend only on their inputs and not on the program state - i.e. pure mathematical functions.
-
Eliminating side effects, i.e. changes in state that don't depend on the function inputs, can make it much easier to understand and predict the behavior of a program, which is one of the key motivations for the development of functional programming.
-
Functional programming has its roots in lambda calculus, a formal system developed in the 1930s
-
In contrast, imperative programming changes state with commands in the source language, the most simple example is the assignment. Functions do exist, not in the mathematical sense, but the sense of subroutine. They can have side effects that may change the value of program state. Functions without return value therefore make sense. Because of this, they lack referential transparency, i.e. the same language expression can result in different values at different times depending on the state of the executing program.
-
-
Lambda calculus provides a theoretical framework for describing functions and their evaluation. Although it is a mathematical abstraction rather than a programming language, it forms the basis of almost all functional programming languages today.
-
Higher-order functions are functions that can either take other functions as arguments or return them as results.
-
Higher-order functions are closely related to first-class functions in that higher-order functions and first-class functions both allow functions as arguments and results of other functions. The distinction between the two is subtle: "higher-order" describes a mathematical concept of functions that operate on other functions, while "first-class" is a computer science term that describes programming language entities that have no restriction on their use (thus first-class functions can appear anywhere in the program that other first-class entities like numbers can, including as arguments to other functions and as their return values).
-
Higher-order functions enable partial application or currying, a technique in which a function is applied to its arguments one at a time, with each application returning a new function that accepts the next argument. This allows one to succinctly express, for example, the successor function as the addition operator partially applied to the natural number one.
-
Purely functional functions (or expressions) have no side effects (memory or I/O). This means that pure functions have several useful properties, many of which can be used to optimize the code
-
Iteration (looping) in functional languages is usually accomplished via recursion. Recursive functions invoke themselves, allowing an operation to be performed over and over until the base case is reached. Though some recursion requires maintaining a stack, tail recursion can be recognized and optimized by a compiler into the same code used to implement iteration in imperative languages.
-
Most general purpose functional programming languages allow unrestricted recursion and are Turing complete, which makes the halting problem undecidable
-
Functional programming languages are typically less efficient in their use of CPU and memory than imperative languages such as C and Pascal.[49] This is related to the fact that some mutable data structures like arrays have a very straightforward implementation using present hardware (which is a highly evolved Turing machine).
-
the presence of checked exceptions in Java can make functional programming inconvenient, because it can be necessary to catch checked exceptions and then rethrow them - a problem that does not occur in other JVM languages that do not have checked exceptions, such as Scala.
-
Many object-oriented design patterns are expressible in functional programming terms: for example, the strategy pattern simply dictates use of a higher-order function, and the visitor pattern roughly corresponds to a catamorphism, or fold.
-
-
25 Jul 13
-
08 Mar 13
-
hematical recurrence relation that defines the entire Fibonacci sequenc
-
-
11 Oct 12
-
21 Aug 12
-
18 Aug 12
-
14 Aug 12
-
It emphasizes the application of functions, in contrast to the imperative programming style, which emphasizes changes in state.
-
-
26 Jul 12
-
-
the same language expression can result in different values at different times depending on the state of the executing program
-
imperative programs define sequences of commands for the computer to perform.
-
Conversely, in functional code, the output value of a function depends only on the arguments that are input to the function, so calling a function f twice with the same value for an argument x will produce the same result f(x) both times
-
Functional programming languages
-
Programming in a functional style
-
including object-oriented programming
-
It is possible to use a functional style of programming in languages that are not traditionally considered functional languages
-
imperative style
-
-
09 Jul 12
-
04 Jul 12
-
03 Jun 12
-
17 May 12
-
23 Feb 12
-
22 Jan 12
-
20 Jan 12
-
30 Sep 11
-
functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data.
-
It emphasizes the application of functions, in contrast to the imperative programming style, which emphasizes changes in state.[1]
-
The most significant differences stem from the fact that functional programming avoids side effects, which are used in imperative programming to implement state and I/O.
-
There are tasks (for example, maintaining a bank account balance) that often seem most naturally implemented with state. Pure functional programming performs these tasks, and I/O tasks such as accepting user input and printing to the screen, in a different way.
-
-
Imperative programs tend to emphasize the series of steps taken by a program in carrying out an action, while functional programs tend to emphasize the composition and arrangement of functions, often without specifying explicit steps.
-
Functional programming has long been popular in academia, but with few industrial applications.[46]:page 11 However, recently several prominent functional programming languages have been used in commercial or industrial systems.
-
-
27 Sep 11
-
08 Sep 11
-
In computer science, functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data.
-
Functional programming has its roots in lambda calculus
-
imperative programming style, which emphasizes changes in state.
-
t imperative functions can have side effects, changing the value of program state. B
-
Lambda calculus provides a theoretical framework for describing functions and their evaluation.
-
An early functional flavored language was Lisp, developed by John McCarthy while at MIT for the IBM 700/7000
-
late 1950s.[2
-
Higher-order functions are functions that can either take other functions as arguments or return them as resu
-
both allow functions as arguments and results of other functions.
-
Higher-order functions are closely related to first-class functions,
-
operate on other function
-
"higher-order" describes a mathematical
-
e no restriction on their use (thus first-class
-
Purely functional functions (or expressions) have no memory or I/O side effects.
-
e result of a pure expression is not used, it can be removed without affecting other
-
pure function is called with parameters that cause no side-effects,
-
no data dependency between two pure expressions, t
-
e does not allow side-effects, then any evaluation strategy can be
-
Recursive functions invoke themselves,
-
The Scheme language standard requires implementations to recognize and optimize tail recursio
-
using higher order functions, with catamorphisms and anamorphisms (or "folds" and "unfolds
-
Common patterns of recursion can be factored out
-
Most general purpose functional programming languages allow unrestricted recursion and are Turing complete, which makes the halting problem undecidable,
-
y whether they use strict (eager) or non-strict (lazy) evaluation, concepts that refer to how function arguments are processed when an expression is being evaluated.
-
e technical difference is in the denotational semantics of expressions c
-
he usual implementation strategy for non-strict evaluation in functional languages is graph reduction
-
o use typed lambda calculus, as opposed to the untyped lambda calculus used in Lisp and its variants (such as Scheme). The use of algebraic datatypes and pattern matching makes manipulation of complex data structures more convenient and expressive
-
A limited form of dependent types called generalized algebraic data types (GADT's) can
-
The Language Integrated Query (LINQ) feature, with its many incarnations, is an obvious and powerful use of functional programming in .NET.
-
-
Functional programming is very different from imperative programming. The most significant differences stem from the fact that functional programming avoids side effects, which are used in imperative programming to implement state and I/O.
-
g monads, derived from category theory. Monads are powerful and offer a way to abstract certain types of computational patterns, including (but not limited to) modeling of computations with mutable state (and other side effects such as I/O) in an imperative manner without losing purity. While existing monads may be easy to apply in a program, given appropriate templates and example
-
Functional programming languages are typically less efficient in their use of CPU and memory tha
-
emphasize the series of steps
-
composition and arrangement of functions, often without specifying explicit step
-
Functional programming has long been popular in academia, but with few industrial applications.
-
-
10 May 11
-
Because of this they lack referential transparency, i.e. the same language expression can result in different values at different times depending on the state of the executing program. Conversely, in functional code, the output value of a function depends only on the arguments that are input to the function, so calling a function f twice with the same value for an argument x will produce the same result f(x) both times.
-
-
-
pure functions have several useful properties, many of which can be used to optimize the code
-
Purely functional functions (or expressions) have no memory or I/O side effects
-
can be removed without affecting other expressions.
-
result of a pure expression is not used
-
-
30 Mar 11
-
06 Mar 11
-
, the difference between a mathematical function and the notion of a "function" used in imperative programming is that imperative functions can have side effects, changing the value of program state. Because of this they lack referential transparency, i.e. the same language expression can result in different values at different times depending on the state of the executing program. Conversely, in functional code, the output value of a function depends only on the arguments that are input to the function, so calling a function f twice with the same value for an argument x will produce the same result f(x) both times. Eliminating side effects can make it much easier to understand and predict the behavior of a program, which is one of the key motivations for the development of functional programming.[1]
-
-
22 Sep 10
johannibrea# Fibonacci numbers, imperative style
N=10
first = 0 # seed value fibonacci(0)
second = 1 # seed value fibonacci(1)
fib_number = first + second # calculate fibonacci(2)
for position in range(N-2): # iterate N-2 times to give Fibonacci number N (for N > 2)
first = second # update the value of the two 'previous' variables
second = fib_number
fib_number = first + second # update the result value to fibonacci(position)
print fib_number
A functional version has a different feel to it:
# Fibonacci numbers, functional style
N=10
# Fibonacci numbers, functional style
def fibonacci(position): # Fibonacci number N (for N >= 0)
if position == 0: return 0 # seed value fibonacci(0)
elif position == 1: return 1 # seed value fibonacci(1)
else: return fibonacci(position-1) + fibonacci(position-2) # calculate fibonacci(position)
fib_number = fibonacci(N)
print fib_number -
02 Sep 10
-
30 Aug 10
-
23 Aug 10
Dante-Gabryell MonsonIn computer science, functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. It emphasizes the application of functions, in contrast to the imperative programm
-
18 Aug 10
-
19 Feb 10
-
functions and their evaluation. Although it is a
-
algebra
-
-
08 Jan 10
-
21 Oct 09
-
23 Sep 09
Sam Rosen computer science, functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. It emphasizes the application of functions, in contrast to the imperative programmi
-
05 Feb 09
-
12 Aug 08
-
19 Jul 08
-
11 May 08
-
09 Oct 07
-
Functions are higher-order when they can take other functions as arguments, and return them as results. (The derivative and antiderivative in calculus are examples of this.)
-
Higher-order functions enable currying, a technique in which a function is applied to its arguments one at a time, with each application returning a new (higher-order) function that accepts the next argument.
-
Strict evaluation has efficiency advantages.
-
Lambda calculus provides a stronger theoretic foundation for languages that employ non-strict evaluation.[11] Also non-strict evaluation provides for a more expressive language. For example, it supports infinite data structures, such as a list of all prime numbers (such structures are of use when an indefinite but finite part of the structure is required).
-
-
01 Jul 07
-
The distinction between the two is subtle: "higher-order" describes a mathematical concept of functions that operate on other functions, while "first-class" is a computer science term that describes programming language entities that have no restriction on their use
-
While most compilers for imperative programming languages detect pure functions, and perform common subexpression elimination for pure function calls
-
Recursion may require maintaining a stack, but tail recursion can be recognized and optimized by a compiler into the same code used to implement iteration in imperative languages.
-
Common patterns of recursion can be factored out using higher order functions
-
Such higher order functions play a role analogous to built-in control structures such as loops in imperative languages.
-
The most significant differences stem from the fact that functional programming avoids side effects, which are used in imperative programming to implement state and I/O.
-
Where a traditional imperative program might use a loop to traverse a list, a functional style would often use a higher-order function, map, that takes as arguments a function and a list, applies the function to each element of the list, and returns a list of the results.
-
-
03 Apr 07
Robert KaymanFunctional programming is a programming paradigm that conceives computation as the evaluation of mathematical functions and avoids state and mutable data. It emphasizes the application of functions, in contrast with imperative programming, which emphasize
programming functional-programming wikipedia development academic Delicious
-
30 Mar 07
-
18 Mar 07
viniciusjlIn computer science, functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. It emphasizes the application of functions, in contrast to the imperative programm
computer_science wikipedia article functional_programming functional programming
-
20 Dec 06
-
12 Nov 06
-
08 Nov 06
-
12 Aug 06
-
10 Jul 06
-
18 Apr 06
-
11 Jan 06
vikramsjnprogramming paradigm that treats computation as the evaluation of mathematical functions. It is more heavily used in academia than in industry. The strength of a functional paradigm is the removal of side-effects during computation
functional programming theory wikipedia deliciousExport20110319
-
08 Mar 05
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.