<s>
In	O
computer	B-General_Concept
science	I-General_Concept
,	O
functional	B-Language
programming	I-Language
is	O
a	O
programming	O
paradigm	O
where	O
programs	O
are	O
constructed	O
by	O
applying	B-Algorithm
and	O
composing	B-Application
functions	O
.	O
</s>
<s>
It	O
is	O
a	O
declarative	B-Language
programming	I-Language
paradigm	O
in	O
which	O
function	O
definitions	O
are	O
trees	B-Application
of	O
expressions	O
that	O
map	O
values	O
to	O
other	O
values	O
,	O
rather	O
than	O
a	O
sequence	O
of	O
imperative	B-Application
statements	O
which	O
update	O
the	O
running	B-Application
state	I-Application
of	O
the	O
program	O
.	O
</s>
<s>
In	O
functional	B-Language
programming	I-Language
,	O
functions	O
are	O
treated	O
as	O
first-class	O
citizens	O
,	O
meaning	O
that	O
they	O
can	O
be	O
bound	O
to	O
names	O
(	O
including	O
local	O
identifiers	O
)	O
,	O
passed	O
as	O
arguments	O
,	O
and	O
returned	B-Language
from	O
other	O
functions	O
,	O
just	O
as	O
any	O
other	O
data	O
type	O
can	O
.	O
</s>
<s>
This	O
allows	O
programs	O
to	O
be	O
written	O
in	O
a	O
declarative	B-Language
and	O
composable	O
style	O
,	O
where	O
small	O
functions	O
are	O
combined	O
in	O
a	O
modular	B-Architecture
manner	O
.	O
</s>
<s>
Functional	B-Language
programming	I-Language
is	O
sometimes	O
treated	O
as	O
synonymous	O
with	O
purely	B-Application
functional	I-Application
programming	I-Application
,	O
a	O
subset	O
of	O
functional	B-Language
programming	I-Language
which	O
treats	O
all	O
functions	O
as	O
deterministic	O
mathematical	O
functions	O
,	O
or	O
pure	B-Application
functions	I-Application
.	O
</s>
<s>
When	O
a	O
pure	B-Application
function	I-Application
is	O
called	O
with	O
some	O
given	O
arguments	O
,	O
it	O
will	O
always	O
return	O
the	O
same	O
result	O
,	O
and	O
cannot	O
be	O
affected	O
by	O
any	O
mutable	B-Application
state	B-Application
or	O
other	O
side	O
effects	O
.	O
</s>
<s>
This	O
is	O
in	O
contrast	O
with	O
impure	O
procedures	O
,	O
common	O
in	O
imperative	B-Application
programming	I-Application
,	O
which	O
can	O
have	O
side	O
effects	O
(	O
such	O
as	O
modifying	O
the	O
program	O
's	O
state	B-Application
or	O
taking	O
input	O
from	O
a	O
user	O
)	O
.	O
</s>
<s>
Proponents	O
of	O
purely	B-Application
functional	I-Application
programming	I-Application
claim	O
that	O
by	O
restricting	O
side	O
effects	O
,	O
programs	O
can	O
have	O
fewer	O
bugs	B-Error_Name
,	O
be	O
easier	O
to	O
debug	O
and	O
test	O
,	O
and	O
be	O
more	O
suited	O
to	O
formal	O
verification	O
.	O
</s>
<s>
Functional	B-Language
programming	I-Language
has	O
its	O
roots	O
in	O
academia	O
,	O
evolving	O
from	O
the	O
lambda	B-Language
calculus	I-Language
,	O
a	O
formal	O
system	O
of	O
computation	O
based	O
only	O
on	O
functions	O
.	O
</s>
<s>
Functional	B-Language
programming	I-Language
has	O
historically	O
been	O
less	O
popular	O
than	O
imperative	B-Application
programming	I-Application
,	O
but	O
many	O
functional	B-Language
languages	I-Language
are	O
seeing	O
use	O
today	O
in	O
industry	O
and	O
education	O
,	O
including	O
Common	B-Language
Lisp	I-Language
,	O
Scheme	B-Language
,	O
Clojure	B-Language
,	O
Wolfram	B-Language
Language	I-Language
,	O
Racket	B-Operating_System
,	O
Erlang	B-Operating_System
,	O
Elixir	B-Language
,	O
OCaml	B-Language
,	O
Haskell	B-Language
,	O
and	O
F#	B-Operating_System
.	O
</s>
<s>
Functional	B-Language
programming	I-Language
is	O
also	O
key	O
to	O
some	O
languages	O
that	O
have	O
found	O
success	O
in	O
specific	O
domains	O
,	O
like	O
JavaScript	B-Language
in	O
the	O
Web	O
,	O
R	B-Language
in	O
statistics	O
,	O
J	B-Language
,	O
K	B-Application
and	O
Q	B-Application
in	O
financial	O
analysis	O
,	O
and	O
XQuery/XSLT	O
for	O
XML	B-Protocol
.	O
</s>
<s>
Domain-specific	O
declarative	B-Language
languages	I-Language
like	O
SQL	B-Language
and	O
Lex/Yacc	O
use	O
some	O
elements	O
of	O
functional	B-Language
programming	I-Language
,	O
such	O
as	O
not	O
allowing	O
mutable	B-Application
values	I-Application
.	O
</s>
<s>
In	O
addition	O
,	O
many	O
other	O
programming	O
languages	O
support	O
programming	O
in	O
a	O
functional	O
style	O
or	O
have	O
implemented	O
features	O
from	O
functional	B-Language
programming	I-Language
,	O
such	O
as	O
C++11	B-Language
,	O
C#	B-Application
,	O
Kotlin	B-Language
,	O
Perl	B-Language
,	O
PHP	B-Application
,	O
Python	B-Language
,	O
Go	B-Application
,	O
Rust	B-Application
,	O
Raku	B-Application
,	O
Scala	B-Application
,	O
and	O
Java	B-Language
(	O
since	O
Java	B-Language
8	O
)	O
.	O
</s>
<s>
The	O
lambda	B-Language
calculus	I-Language
,	O
developed	O
in	O
the	O
1930s	O
by	O
Alonzo	O
Church	O
,	O
is	O
a	O
formal	O
system	O
of	O
computation	O
built	O
from	O
function	B-Algorithm
application	I-Algorithm
.	O
</s>
<s>
In	O
1937	O
Alan	O
Turing	O
proved	O
that	O
the	O
lambda	B-Language
calculus	I-Language
and	O
Turing	B-Architecture
machines	I-Architecture
are	O
equivalent	O
models	O
of	O
computation	O
,	O
showing	O
that	O
the	O
lambda	B-Language
calculus	I-Language
is	O
Turing	B-Algorithm
complete	I-Algorithm
.	O
</s>
<s>
Lambda	B-Language
calculus	I-Language
forms	O
the	O
basis	O
of	O
all	O
functional	B-Language
programming	I-Language
languages	I-Language
.	O
</s>
<s>
An	O
equivalent	O
theoretical	O
formulation	O
,	O
combinatory	B-Application
logic	I-Application
,	O
was	O
developed	O
by	O
Moses	O
Schönfinkel	O
and	O
Haskell	B-Language
Curry	B-Application
in	O
the	O
1920s	O
and	O
1930s	O
.	O
</s>
<s>
Church	O
later	O
developed	O
a	O
weaker	O
system	O
,	O
the	O
simply-typed	O
lambda	B-Language
calculus	I-Language
,	O
which	O
extended	O
the	O
lambda	B-Language
calculus	I-Language
by	O
assigning	O
a	O
data	O
type	O
to	O
all	O
terms	O
.	O
</s>
<s>
This	O
forms	O
the	O
basis	O
for	O
statically-typed	O
functional	B-Language
programming	I-Language
.	O
</s>
<s>
The	O
first	O
high-level	B-Language
functional	B-Language
programming	I-Language
language	I-Language
,	O
Lisp	B-Language
,	O
was	O
developed	O
in	O
the	O
late	O
1950s	O
for	O
the	O
IBM	O
700/7000	O
series	O
of	O
scientific	O
computers	O
by	O
John	O
McCarthy	O
while	O
at	O
Massachusetts	O
Institute	O
of	O
Technology	O
(	O
MIT	O
)	O
.	O
</s>
<s>
Lisp	B-Language
functions	O
were	O
defined	O
using	O
Church	O
's	O
lambda	B-General_Concept
notation	O
,	O
extended	O
with	O
a	O
label	O
construct	O
to	O
allow	O
recursive	O
functions	O
.	O
</s>
<s>
Lisp	B-Language
first	O
introduced	O
many	O
paradigmatic	O
features	O
of	O
functional	B-Language
programming	I-Language
,	O
though	O
early	O
Lisps	B-Language
were	O
multi-paradigm	O
languages	O
,	O
and	O
incorporated	O
support	O
for	O
numerous	O
programming	O
styles	O
as	O
new	O
paradigms	O
evolved	O
.	O
</s>
<s>
Later	O
dialects	O
,	O
such	O
as	O
Scheme	B-Language
and	O
Clojure	B-Language
,	O
and	O
offshoots	O
such	O
as	O
Dylan	B-Language
and	O
Julia	B-Application
,	O
sought	O
to	O
simplify	O
and	O
rationalise	O
Lisp	B-Language
around	O
a	O
cleanly	O
functional	O
core	O
,	O
while	O
Common	B-Language
Lisp	I-Language
was	O
designed	O
to	O
preserve	O
and	O
update	O
the	O
paradigmatic	O
features	O
of	O
the	O
numerous	O
older	O
dialects	O
it	O
replaced	O
.	O
</s>
<s>
Information	B-Language
Processing	I-Language
Language	I-Language
(	O
IPL	B-Language
)	O
,	O
1956	O
,	O
is	O
sometimes	O
cited	O
as	O
the	O
first	O
computer-based	O
functional	B-Language
programming	I-Language
language	I-Language
.	O
</s>
<s>
It	O
is	O
an	O
assembly-style	B-Language
language	I-Language
for	O
manipulating	O
lists	O
of	O
symbols	O
.	O
</s>
<s>
It	O
does	O
have	O
a	O
notion	O
of	O
generator	O
,	O
which	O
amounts	O
to	O
a	O
function	O
that	O
accepts	O
a	O
function	O
as	O
an	O
argument	O
,	O
and	O
,	O
since	O
it	O
is	O
an	O
assembly-level	O
language	O
,	O
code	O
can	O
be	O
data	O
,	O
so	O
IPL	B-Language
can	O
be	O
regarded	O
as	O
having	O
higher-order	B-Language
functions	I-Language
.	O
</s>
<s>
However	O
,	O
it	O
relies	O
heavily	O
on	O
the	O
mutating	O
list	O
structure	O
and	O
similar	O
imperative	B-Application
features	O
.	O
</s>
<s>
Kenneth	O
E	O
.	O
Iverson	O
developed	O
APL	B-Language
in	O
the	O
early	O
1960s	O
,	O
described	O
in	O
his	O
1962	O
book	O
A	B-Language
Programming	I-Language
Language	I-Language
(	O
)	O
.	O
</s>
<s>
APL	B-Language
was	O
the	O
primary	O
influence	O
on	O
John	O
Backus	O
's	O
FP	B-Language
.	O
</s>
<s>
In	O
the	O
early	O
1990s	O
,	O
Iverson	O
and	O
Roger	O
Hui	O
created	O
J	B-Language
.	O
</s>
<s>
In	O
the	O
mid-1990s	O
,	O
Arthur	O
Whitney	O
,	O
who	O
had	O
previously	O
worked	O
with	O
Iverson	O
,	O
created	O
K	B-Application
,	O
which	O
is	O
used	O
commercially	O
in	O
financial	O
industries	O
along	O
with	O
its	O
descendant	O
Q	B-Application
.	O
</s>
<s>
In	O
the	O
mid	O
1960s	O
,	O
Peter	O
Landin	O
invented	O
SECD	B-Application
machine	I-Application
,	O
the	O
first	O
abstract	B-Application
machine	I-Application
for	O
a	O
functional	B-Language
programming	I-Language
language	I-Language
,	O
described	O
a	O
correspondence	O
between	O
ALGOL	B-Language
60	I-Language
and	O
the	O
lambda	B-Language
calculus	I-Language
,	O
and	O
proposed	O
the	O
ISWIM	B-Language
programming	I-Language
language	I-Language
.	O
</s>
<s>
John	O
Backus	O
presented	O
FP	B-Language
in	O
his	O
1977	O
Turing	O
Award	O
lecture	O
"	O
Can	O
Programming	O
Be	O
Liberated	O
From	O
the	O
von	B-Architecture
Neumann	I-Architecture
Style	I-Architecture
?	O
</s>
<s>
He	O
defines	O
functional	B-Language
programs	I-Language
as	O
being	O
built	O
up	O
in	O
a	O
hierarchical	O
way	O
by	O
means	O
of	O
"	O
combining	O
forms	O
"	O
that	O
allow	O
an	O
"	O
algebra	O
of	O
programs	O
"	O
;	O
in	O
modern	O
language	O
,	O
this	O
means	O
that	O
functional	B-Language
programs	I-Language
follow	O
the	O
principle	O
of	O
compositionality	O
.	O
</s>
<s>
Backus	O
's	O
paper	O
popularized	O
research	O
into	O
functional	B-Language
programming	I-Language
,	O
though	O
it	O
emphasized	O
function-level	B-Application
programming	I-Application
rather	O
than	O
the	O
lambda-calculus	B-Language
style	O
now	O
associated	O
with	O
functional	B-Language
programming	I-Language
.	O
</s>
<s>
The	O
1973	O
language	O
ML	B-Algorithm
was	O
created	O
by	O
Robin	O
Milner	O
at	O
the	O
University	O
of	O
Edinburgh	O
,	O
and	O
David	O
Turner	O
developed	O
the	O
language	O
SASL	B-Language
at	O
the	O
University	O
of	O
St	O
Andrews	O
.	O
</s>
<s>
Also	O
in	O
Edinburgh	O
in	O
the	O
1970s	O
,	O
Burstall	O
and	O
Darlington	O
developed	O
the	O
functional	B-Language
language	I-Language
NPL	B-Language
.	O
</s>
<s>
NPL	B-Language
was	O
based	O
on	O
Kleene	O
Recursion	O
Equations	O
and	O
was	O
first	O
introduced	O
in	O
their	O
work	O
on	O
program	O
transformation	O
.	O
</s>
<s>
Burstall	O
,	O
MacQueen	O
and	O
Sannella	O
then	O
incorporated	O
the	O
polymorphic	O
type	O
checking	O
from	O
ML	B-Algorithm
to	O
produce	O
the	O
language	O
Hope	B-Language
.	O
</s>
<s>
ML	B-Algorithm
eventually	O
developed	O
into	O
several	O
dialects	O
,	O
the	O
most	O
common	O
of	O
which	O
are	O
now	O
OCaml	B-Language
and	O
Standard	B-Language
ML	I-Language
.	O
</s>
<s>
In	O
the	O
1970s	O
,	O
Guy	O
L	O
.	O
Steele	O
and	O
Gerald	O
Jay	O
Sussman	O
developed	O
Scheme	B-Language
,	O
as	O
described	O
in	O
the	O
Lambda	B-General_Concept
Papers	O
and	O
the	O
1985	O
textbook	O
Structure	B-Language
and	I-Language
Interpretation	I-Language
of	I-Language
Computer	I-Language
Programs	I-Language
.	O
</s>
<s>
Scheme	B-Language
was	O
the	O
first	O
dialect	O
of	O
lisp	B-Language
to	O
use	O
lexical	O
scoping	O
and	O
to	O
require	O
tail-call	B-Language
optimization	I-Language
,	O
features	O
that	O
encourage	O
functional	B-Language
programming	I-Language
.	O
</s>
<s>
In	O
the	O
1980s	O
,	O
Per	O
Martin-Löf	O
developed	O
intuitionistic	O
type	O
theory	O
(	O
also	O
called	O
constructive	O
type	O
theory	O
)	O
,	O
which	O
associated	O
functional	B-Language
programs	I-Language
with	O
constructive	O
proofs	O
expressed	O
as	O
dependent	O
types	O
.	O
</s>
<s>
This	O
led	O
to	O
new	O
approaches	O
to	O
interactive	O
theorem	O
proving	O
and	O
has	O
influenced	O
the	O
development	O
of	O
subsequent	O
functional	B-Language
programming	I-Language
languages	I-Language
.	O
</s>
<s>
The	O
lazy	O
functional	B-Language
language	I-Language
,	O
Miranda	B-Language
,	O
developed	O
by	O
David	O
Turner	O
,	O
initially	O
appeared	O
in	O
1985	O
and	O
had	O
a	O
strong	O
influence	O
on	O
Haskell	B-Language
.	O
</s>
<s>
With	O
Miranda	B-Language
being	O
proprietary	O
,	O
Haskell	B-Language
began	O
with	O
a	O
consensus	O
in	O
1987	O
to	O
form	O
an	O
open	O
standard	O
for	O
functional	B-Language
programming	I-Language
research	O
;	O
implementation	O
releases	O
have	O
been	O
ongoing	O
since	O
1990	O
.	O
</s>
<s>
More	O
recently	O
it	O
has	O
found	O
use	O
in	O
niches	O
such	O
as	O
parametric	O
CAD	B-Application
in	O
the	O
OpenSCAD	B-Language
language	O
built	O
on	O
the	O
CGAL	B-Language
framework	O
,	O
although	O
its	O
restriction	O
on	O
reassigning	O
values	O
(	O
all	O
values	O
are	O
treated	O
as	O
constants	O
)	O
has	O
led	O
to	O
confusion	O
among	O
users	O
who	O
are	O
unfamiliar	O
with	O
functional	B-Language
programming	I-Language
as	O
a	O
concept	O
.	O
</s>
<s>
Functional	B-Language
programming	I-Language
continues	O
to	O
be	O
used	O
in	O
commercial	O
settings	O
.	O
</s>
<s>
A	O
number	O
of	O
concepts	O
and	O
paradigms	O
are	O
specific	O
to	O
functional	B-Language
programming	I-Language
,	O
and	O
generally	O
foreign	O
to	O
imperative	B-Application
programming	I-Application
(	O
including	O
object-oriented	B-Language
programming	I-Language
)	O
.	O
</s>
<s>
However	O
,	O
programming	O
languages	O
often	O
cater	O
to	O
several	O
programming	O
paradigms	O
,	O
so	O
programmers	O
using	O
"	O
mostly	O
imperative	B-Application
"	O
languages	O
may	O
have	O
utilized	O
some	O
of	O
these	O
concepts	O
.	O
</s>
<s>
Higher-order	B-Language
functions	I-Language
are	O
functions	O
that	O
can	O
either	O
take	O
other	O
functions	O
as	O
arguments	O
or	O
return	O
them	O
as	O
results	O
.	O
</s>
<s>
In	O
calculus	O
,	O
an	O
example	O
of	O
a	O
higher-order	B-Language
function	I-Language
is	O
the	O
differential	O
operator	O
,	O
which	O
returns	O
the	O
derivative	B-Algorithm
of	I-Algorithm
a	I-Algorithm
function	I-Algorithm
.	O
</s>
<s>
Higher-order	B-Language
functions	I-Language
are	O
closely	O
related	O
to	O
first-class	B-Application
functions	I-Application
in	O
that	O
higher-order	B-Language
functions	I-Language
and	O
first-class	B-Application
functions	I-Application
both	O
allow	O
functions	O
as	O
arguments	O
and	O
results	O
of	O
other	O
functions	O
.	O
</s>
<s>
The	O
distinction	O
between	O
the	O
two	O
is	O
subtle	O
:	O
"	O
higher-order	O
"	O
describes	O
a	O
mathematical	O
concept	O
of	O
functions	O
that	O
operate	O
on	O
other	O
functions	O
,	O
while	O
"	O
first-class	O
"	O
is	O
a	O
computer	B-General_Concept
science	I-General_Concept
term	O
for	O
programming	O
language	O
entities	O
that	O
have	O
no	O
restriction	O
on	O
their	O
use	O
(	O
thus	O
first-class	B-Application
functions	I-Application
can	O
appear	O
anywhere	O
in	O
the	O
program	O
that	O
other	O
first-class	O
entities	O
like	O
numbers	O
can	O
,	O
including	O
as	O
arguments	O
to	O
other	O
functions	O
and	O
as	O
their	O
return	B-Language
values	I-Language
)	O
.	O
</s>
<s>
Higher-order	B-Language
functions	I-Language
enable	O
partial	B-Application
application	I-Application
or	O
currying	B-Application
,	O
a	O
technique	O
that	O
applies	O
a	O
function	O
to	O
its	O
arguments	O
one	O
at	O
a	O
time	O
,	O
with	O
each	O
application	O
returning	O
a	O
new	O
function	O
that	O
accepts	O
the	O
next	O
argument	O
.	O
</s>
<s>
Pure	B-Application
functions	I-Application
(	O
or	O
expressions	O
)	O
have	O
no	O
side	O
effects	O
(	O
memory	O
or	O
I/O	O
)	O
.	O
</s>
<s>
This	O
means	O
that	O
pure	B-Application
functions	I-Application
have	O
several	O
useful	O
properties	O
,	O
many	O
of	O
which	O
can	O
be	O
used	O
to	O
optimize	O
the	O
code	O
:	O
</s>
<s>
If	O
a	O
pure	B-Application
function	I-Application
is	O
called	O
with	O
arguments	O
that	O
cause	O
no	O
side-effects	O
,	O
the	O
result	O
is	O
constant	O
with	O
respect	O
to	O
that	O
argument	O
list	O
(	O
sometimes	O
called	O
referential	O
transparency	O
or	O
idempotence	O
)	O
,	O
i.e.	O
,	O
calling	O
the	O
pure	B-Application
function	I-Application
again	O
with	O
the	O
same	O
arguments	O
returns	O
the	O
same	O
result	O
.	O
</s>
<s>
If	O
there	O
is	O
no	O
data	O
dependency	O
between	O
two	O
pure	O
expressions	O
,	O
their	O
order	O
can	O
be	O
reversed	O
,	O
or	O
they	O
can	O
be	O
performed	O
in	O
parallel	B-Operating_System
and	O
they	O
cannot	O
interfere	O
with	O
one	O
another	O
(	O
in	O
other	O
terms	O
,	O
the	O
evaluation	O
of	O
any	O
pure	O
expression	O
is	O
thread-safe	B-Operating_System
)	O
.	O
</s>
<s>
If	O
the	O
entire	O
language	O
does	O
not	O
allow	O
side-effects	O
,	O
then	O
any	O
evaluation	O
strategy	O
can	O
be	O
used	O
;	O
this	O
gives	O
the	O
compiler	B-Language
freedom	O
to	O
reorder	O
or	O
combine	O
the	O
evaluation	O
of	O
expressions	O
in	O
a	O
program	O
(	O
for	O
example	O
,	O
using	O
deforestation	B-Application
)	O
.	O
</s>
<s>
While	O
most	O
compilers	B-Language
for	O
imperative	B-Application
programming	I-Application
languages	I-Application
detect	O
pure	B-Application
functions	I-Application
and	O
perform	O
common-subexpression	O
elimination	O
for	O
pure	B-Application
function	I-Application
calls	O
,	O
they	O
cannot	O
always	O
do	O
this	O
for	O
pre-compiled	O
libraries	O
,	O
which	O
generally	O
do	O
not	O
expose	O
this	O
information	O
,	O
thus	O
preventing	O
optimizations	O
that	O
involve	O
those	O
external	O
functions	O
.	O
</s>
<s>
Some	O
compilers	B-Language
,	O
such	O
as	O
gcc	B-Application
,	O
add	O
extra	O
keywords	O
for	O
a	O
programmer	O
to	O
explicitly	O
mark	O
external	O
functions	O
as	O
pure	O
,	O
to	O
enable	O
such	O
optimizations	O
.	O
</s>
<s>
C++11	B-Language
added	O
constexpr	O
keyword	O
with	O
similar	O
semantics	O
.	O
</s>
<s>
Iteration	B-Algorithm
(	O
looping	O
)	O
in	O
functional	B-Language
languages	I-Language
is	O
usually	O
accomplished	O
via	O
recursion	O
.	O
</s>
<s>
In	O
general	O
,	O
recursion	O
requires	O
maintaining	O
a	O
stack	B-General_Concept
,	O
which	O
consumes	O
space	O
in	O
a	O
linear	O
amount	O
to	O
the	O
depth	O
of	O
recursion	O
.	O
</s>
<s>
This	O
could	O
make	O
recursion	O
prohibitively	O
expensive	O
to	O
use	O
instead	O
of	O
imperative	B-Application
loops	O
.	O
</s>
<s>
However	O
,	O
a	O
special	O
form	O
of	O
recursion	O
known	O
as	O
tail	B-Language
recursion	I-Language
can	O
be	O
recognized	O
and	O
optimized	O
by	O
a	O
compiler	B-Language
into	O
the	O
same	O
code	O
used	O
to	O
implement	O
iteration	B-Algorithm
in	O
imperative	B-Application
languages	I-Application
.	O
</s>
<s>
Tail	B-Language
recursion	I-Language
optimization	I-Language
can	O
be	O
implemented	O
by	O
transforming	O
the	O
program	O
into	O
continuation	B-Application
passing	I-Application
style	I-Application
during	O
compiling	B-Language
,	O
among	O
other	O
approaches	O
.	O
</s>
<s>
The	O
Scheme	B-Language
language	I-Language
standard	O
requires	O
implementations	O
to	O
support	O
proper	B-Language
tail	I-Language
recursion	I-Language
,	O
meaning	O
they	O
must	O
allow	O
an	O
unbounded	O
number	O
of	O
active	O
tail	B-Language
calls	I-Language
.	O
</s>
<s>
Proper	B-Language
tail	I-Language
recursion	I-Language
is	O
not	O
simply	O
an	O
optimization	O
;	O
it	O
is	O
a	O
language	O
feature	O
that	O
assures	O
users	O
that	O
they	O
can	O
use	O
recursion	O
to	O
express	O
a	O
loop	O
and	O
doing	O
so	O
would	O
be	O
safe-for-space	O
.	O
</s>
<s>
Moreover	O
,	O
contrary	O
to	O
its	O
name	O
,	O
it	O
accounts	O
for	O
all	O
tail	B-Language
calls	I-Language
,	O
not	O
just	O
tail	B-Language
recursion	I-Language
.	O
</s>
<s>
While	O
proper	B-Language
tail	I-Language
recursion	I-Language
is	O
usually	O
implemented	O
by	O
turning	O
code	O
into	O
imperative	B-Application
loops	O
,	O
implementations	O
might	O
implement	O
it	O
in	O
other	O
ways	O
.	O
</s>
<s>
For	O
example	O
,	O
Chicken	B-Language
intentionally	O
maintains	O
a	O
stack	B-General_Concept
and	O
lets	O
the	O
stack	B-Error_Name
overflow	I-Error_Name
.	O
</s>
<s>
However	O
,	O
when	O
this	O
happens	O
,	O
its	O
garbage	B-General_Concept
collector	I-General_Concept
will	O
claim	O
space	O
back	O
,	O
allowing	O
an	O
unbounded	O
number	O
of	O
active	O
tail	B-Language
calls	I-Language
even	O
though	O
it	O
does	O
not	O
turn	O
tail	B-Language
recursion	I-Language
into	O
a	O
loop	O
.	O
</s>
<s>
Common	O
patterns	O
of	O
recursion	O
can	O
be	O
abstracted	O
away	O
using	O
higher-order	B-Language
functions	I-Language
,	O
with	O
catamorphisms	B-Application
and	O
anamorphisms	B-Application
(	O
or	O
"	O
folds	O
"	O
and	O
"	O
unfolds	B-Application
"	O
)	O
being	O
the	O
most	O
obvious	O
examples	O
.	O
</s>
<s>
Such	O
recursion	O
schemes	O
play	O
a	O
role	O
analogous	O
to	O
built-in	O
control	O
structures	O
such	O
as	O
loops	O
in	O
imperative	B-Application
languages	I-Application
.	O
</s>
<s>
Most	O
general	O
purpose	O
functional	B-Language
programming	I-Language
languages	I-Language
allow	O
unrestricted	O
recursion	O
and	O
are	O
Turing	B-Algorithm
complete	I-Algorithm
,	O
which	O
makes	O
the	O
halting	O
problem	O
undecidable	O
,	O
can	O
cause	O
unsoundness	O
of	O
equational	O
reasoning	O
,	O
and	O
generally	O
requires	O
the	O
introduction	O
of	O
inconsistency	O
into	O
the	O
logic	O
expressed	O
by	O
the	O
language	O
's	O
type	O
system	O
.	O
</s>
<s>
Some	O
special	O
purpose	O
languages	O
such	O
as	O
Coq	B-Application
allow	O
only	O
well-founded	B-Algorithm
recursion	O
and	O
are	O
strongly	O
normalizing	O
(	O
nonterminating	O
computations	O
can	O
be	O
expressed	O
only	O
with	O
infinite	O
streams	O
of	O
values	O
called	O
codata	O
)	O
.	O
</s>
<s>
As	O
a	O
consequence	O
,	O
these	O
languages	O
fail	O
to	O
be	O
Turing	B-Algorithm
complete	I-Algorithm
and	O
expressing	O
certain	O
functions	O
in	O
them	O
is	O
impossible	O
,	O
but	O
they	O
can	O
still	O
express	O
a	O
wide	O
class	O
of	O
interesting	O
computations	O
while	O
avoiding	O
the	O
problems	O
introduced	O
by	O
unrestricted	O
recursion	O
.	O
</s>
<s>
Functional	B-Language
programming	I-Language
limited	O
to	O
well-founded	B-Algorithm
recursion	O
with	O
a	O
few	O
other	O
constraints	O
is	O
called	O
total	B-Application
functional	I-Application
programming	I-Application
.	O
</s>
<s>
Functional	B-Language
languages	I-Language
can	O
be	O
categorized	O
by	O
whether	O
they	O
use	O
strict	O
(	O
eager	O
)	O
or	O
non-strict	O
(	O
lazy	O
)	O
evaluation	O
,	O
concepts	O
that	O
refer	O
to	O
how	O
function	O
arguments	O
are	O
processed	O
when	O
an	O
expression	O
is	O
being	O
evaluated	O
.	O
</s>
<s>
The	O
technical	O
difference	O
is	O
in	O
the	O
denotational	B-Application
semantics	I-Application
of	O
expressions	O
containing	O
failing	O
or	O
divergent	O
computations	O
.	O
</s>
<s>
The	O
usual	O
implementation	O
strategy	O
for	O
lazy	O
evaluation	O
in	O
functional	B-Language
languages	I-Language
is	O
graph	B-Application
reduction	I-Application
.	O
</s>
<s>
Lazy	O
evaluation	O
is	O
used	O
by	O
default	O
in	O
several	O
pure	B-Application
functional	I-Application
languages	O
,	O
including	O
Miranda	B-Language
,	O
Clean	B-Operating_System
,	O
and	O
Haskell	B-Language
.	O
</s>
<s>
argues	O
for	O
lazy	O
evaluation	O
as	O
a	O
mechanism	O
for	O
improving	O
program	O
modularity	B-Architecture
through	O
separation	O
of	O
concerns	O
,	O
by	O
easing	O
independent	O
implementation	O
of	O
producers	O
and	O
consumers	O
of	O
data	O
streams	O
.	O
</s>
<s>
Especially	O
since	O
the	O
development	O
of	O
Hindley	B-Algorithm
–	I-Algorithm
Milner	I-Algorithm
type	I-Algorithm
inference	I-Algorithm
in	O
the	O
1970s	O
,	O
functional	B-Language
programming	I-Language
languages	I-Language
have	O
tended	O
to	O
use	O
typed	O
lambda	B-Language
calculus	I-Language
,	O
rejecting	O
all	O
invalid	O
programs	O
at	O
compilation	B-Language
time	O
and	O
risking	O
false	O
positive	O
errors	O
,	O
as	O
opposed	O
to	O
the	O
untyped	B-Application
lambda	I-Application
calculus	I-Application
,	O
that	O
accepts	O
all	O
valid	O
programs	O
at	O
compilation	B-Language
time	O
and	O
risks	O
false	O
negative	O
errors	O
,	O
used	O
in	O
Lisp	B-Language
and	O
its	O
variants	O
(	O
such	O
as	O
Scheme	B-Language
)	O
,	O
as	O
they	O
reject	O
all	O
invalid	O
programs	O
at	O
runtime	O
when	O
the	O
information	O
is	O
enough	O
to	O
not	O
reject	O
valid	O
programs	O
.	O
</s>
<s>
The	O
use	O
of	O
algebraic	O
datatypes	O
makes	O
manipulation	O
of	O
complex	O
data	B-General_Concept
structures	I-General_Concept
convenient	O
;	O
the	O
presence	O
of	O
strong	O
compile-time	O
type	O
checking	O
makes	O
programs	O
more	O
reliable	O
in	O
absence	O
of	O
other	O
reliability	O
techniques	O
like	O
test-driven	O
development	O
,	O
while	O
type	O
inference	O
frees	O
the	O
programmer	O
from	O
the	O
need	O
to	O
manually	O
declare	O
types	O
to	O
the	O
compiler	B-Language
in	O
most	O
cases	O
.	O
</s>
<s>
Some	O
research-oriented	O
functional	B-Language
languages	I-Language
such	O
as	O
Coq	B-Application
,	O
Agda	B-Language
,	O
Cayenne	O
,	O
and	O
Epigram	B-Language
are	O
based	O
on	O
intuitionistic	O
type	O
theory	O
,	O
which	O
lets	O
types	O
depend	O
on	O
terms	O
.	O
</s>
<s>
But	O
dependent	O
types	O
can	O
express	O
arbitrary	O
propositions	O
in	O
higher-order	B-Algorithm
logic	I-Algorithm
.	O
</s>
<s>
Through	O
the	O
Curry	B-Application
–	O
Howard	O
isomorphism	O
,	O
then	O
,	O
well-typed	O
programs	O
in	O
these	O
languages	O
become	O
a	O
means	O
of	O
writing	O
formal	O
mathematical	O
proofs	O
from	O
which	O
a	O
compiler	B-Language
can	O
generate	O
certified	O
code	O
.	O
</s>
<s>
Compcert	B-Application
is	O
a	O
compiler	B-Language
for	O
a	O
subset	O
of	O
the	O
C	B-Language
programming	I-Language
language	I-Language
that	O
is	O
written	O
in	O
Coq	B-Application
and	O
formally	O
verified	O
.	O
</s>
<s>
A	O
limited	O
form	O
of	O
dependent	O
types	O
called	O
generalized	B-Application
algebraic	I-Application
data	I-Application
types	I-Application
(	O
GADT	B-Application
's	O
)	O
can	O
be	O
implemented	O
in	O
a	O
way	O
that	O
provides	O
some	O
of	O
the	O
benefits	O
of	O
dependently	O
typed	O
programming	O
while	O
avoiding	O
most	O
of	O
its	O
inconvenience	O
.	O
</s>
<s>
GADT	B-Application
's	O
are	O
available	O
in	O
the	B-Application
Glasgow	I-Application
Haskell	I-Application
Compiler	I-Application
,	O
in	O
OCaml	B-Language
and	O
in	O
Scala	B-Application
,	O
and	O
have	O
been	O
proposed	O
as	O
additions	O
to	O
other	O
languages	O
including	O
Java	B-Language
and	O
C#	B-Application
.	O
</s>
<s>
Functional	B-Language
programs	I-Language
do	O
not	O
have	O
assignment	O
statements	O
,	O
that	O
is	O
,	O
the	O
value	O
of	O
a	O
variable	O
in	O
a	O
functional	B-Language
program	I-Language
never	O
changes	O
once	O
defined	O
.	O
</s>
<s>
So	O
,	O
functional	B-Language
programs	I-Language
are	O
referentially	O
transparent	O
.	O
</s>
<s>
Consider	O
C	B-Language
assignment	O
statement	O
x	O
=	O
x	O
*	O
10	O
,	O
this	O
changes	O
the	O
value	O
assigned	O
to	O
the	O
variable	O
x	O
.	O
</s>
<s>
Functional	B-Language
programs	I-Language
exclusively	O
use	O
this	O
type	O
of	O
function	O
and	O
are	O
therefore	O
referentially	O
transparent	O
.	O
</s>
<s>
Purely	O
functional	O
data	B-General_Concept
structures	I-General_Concept
are	O
often	O
represented	O
in	O
a	O
different	O
way	O
than	O
their	O
imperative	B-Application
counterparts	O
.	O
</s>
<s>
For	O
example	O
,	O
the	O
array	B-Application
with	O
constant	O
access	O
and	O
update	O
times	O
is	O
a	O
basic	O
component	O
of	O
most	O
imperative	B-Application
languages	I-Application
,	O
and	O
many	O
imperative	B-Application
data-structures	O
,	O
such	O
as	O
the	O
hash	B-Algorithm
table	I-Algorithm
and	O
binary	B-Application
heap	I-Application
,	O
are	O
based	O
on	O
arrays	O
.	O
</s>
<s>
Arrays	O
can	O
be	O
replaced	O
by	O
maps	B-Application
or	O
random	O
access	O
lists	O
,	O
which	O
admit	O
purely	O
functional	O
implementation	O
,	O
but	O
have	O
logarithmic	O
access	O
and	O
update	O
times	O
.	O
</s>
<s>
Purely	O
functional	O
data	B-General_Concept
structures	I-General_Concept
have	O
persistence	B-Application
,	O
a	O
property	O
of	O
keeping	O
previous	O
versions	O
of	O
the	O
data	B-General_Concept
structure	I-General_Concept
unmodified	O
.	O
</s>
<s>
In	O
Clojure	B-Language
,	O
persistent	B-Application
data	I-Application
structures	I-Application
are	O
used	O
as	O
functional	O
alternatives	O
to	O
their	O
imperative	B-Application
counterparts	O
.	O
</s>
<s>
Persistent	O
vectors	O
,	O
for	O
example	O
,	O
use	O
trees	B-Application
for	O
partial	O
updating	O
.	O
</s>
<s>
Functional	B-Language
programming	I-Language
is	O
very	O
different	O
from	O
imperative	B-Application
programming	I-Application
.	O
</s>
<s>
The	O
most	O
significant	O
differences	O
stem	O
from	O
the	O
fact	O
that	O
functional	B-Language
programming	I-Language
avoids	O
side	O
effects	O
,	O
which	O
are	O
used	O
in	O
imperative	B-Application
programming	I-Application
to	O
implement	O
state	B-Application
and	O
I/O	O
.	O
</s>
<s>
Pure	B-Application
functional	I-Application
programming	I-Application
completely	O
prevents	O
side-effects	O
and	O
provides	O
referential	O
transparency	O
.	O
</s>
<s>
Higher-order	B-Language
functions	I-Language
are	O
rarely	O
used	O
in	O
older	O
imperative	B-Application
programming	I-Application
.	O
</s>
<s>
A	O
traditional	O
imperative	B-Application
program	I-Application
might	O
use	O
a	O
loop	O
to	O
traverse	O
and	O
modify	O
a	O
list	O
.	O
</s>
<s>
A	O
functional	B-Language
program	I-Language
,	O
on	O
the	O
other	O
hand	O
,	O
would	O
probably	O
use	O
a	O
higher-order	O
"	O
map	O
"	O
function	O
that	O
takes	O
a	O
function	O
and	O
a	O
list	O
,	O
generating	O
and	O
returning	O
a	O
new	O
list	O
by	O
applying	B-Algorithm
the	O
function	O
to	O
each	O
list	O
item	O
.	O
</s>
<s>
The	O
following	O
two	O
examples	O
(	O
written	O
in	O
JavaScript	B-Language
)	O
achieve	O
the	O
same	O
effect	O
:	O
they	O
multiply	O
all	O
even	O
numbers	O
in	O
an	O
array	B-Application
by	O
10	O
and	O
add	O
them	O
all	O
,	O
storing	O
the	O
final	O
sum	O
in	O
the	O
variable	O
"	O
result	O
"	O
.	O
</s>
<s>
Traditional	O
Imperative	B-Application
Loop	O
:	O
</s>
<s>
Functional	B-Language
Programming	I-Language
with	O
higher-order	B-Language
functions	I-Language
:	O
</s>
<s>
There	O
are	O
tasks	O
(	O
for	O
example	O
,	O
maintaining	O
a	O
bank	O
account	O
balance	O
)	O
that	O
often	O
seem	O
most	O
naturally	O
implemented	O
with	O
state	B-Application
.	O
</s>
<s>
Pure	B-Application
functional	I-Application
programming	I-Application
performs	O
these	O
tasks	O
,	O
and	O
I/O	O
tasks	O
such	O
as	O
accepting	O
user	O
input	O
and	O
printing	O
to	O
the	O
screen	O
,	O
in	O
a	O
different	O
way	O
.	O
</s>
<s>
The	O
pure	B-Application
functional	I-Application
programming	I-Application
language	O
Haskell	B-Language
implements	O
them	O
using	O
monads	O
,	O
derived	O
from	O
category	O
theory	O
.	O
</s>
<s>
Monads	O
offer	O
a	O
way	O
to	O
abstract	O
certain	O
types	O
of	O
computational	O
patterns	O
,	O
including	O
(	O
but	O
not	O
limited	O
to	O
)	O
modeling	O
of	O
computations	O
with	O
mutable	B-Application
state	B-Application
(	O
and	O
other	O
side	O
effects	O
such	O
as	O
I/O	O
)	O
in	O
an	O
imperative	B-Application
manner	O
without	O
losing	O
purity	O
.	O
</s>
<s>
Functional	B-Language
languages	I-Language
also	O
simulate	O
states	O
by	O
passing	O
around	O
immutable	B-Application
states	O
.	O
</s>
<s>
This	O
can	O
be	O
done	O
by	O
making	O
a	O
function	O
accept	O
the	O
state	B-Application
as	O
one	O
of	O
its	O
parameters	O
,	O
and	O
return	O
a	O
new	O
state	B-Application
together	O
with	O
the	O
result	O
,	O
leaving	O
the	O
old	O
state	B-Application
unchanged	O
.	O
</s>
<s>
Impure	O
functional	B-Language
languages	I-Language
usually	O
include	O
a	O
more	O
direct	O
method	O
of	O
managing	O
mutable	B-Application
state	B-Application
.	O
</s>
<s>
Clojure	B-Language
,	O
for	O
example	O
,	O
uses	O
managed	O
references	O
that	O
can	O
be	O
updated	O
by	O
applying	B-Algorithm
pure	B-Application
functions	I-Application
to	O
the	O
current	O
state	B-Application
.	O
</s>
<s>
This	O
kind	O
of	O
approach	O
enables	O
mutability	O
while	O
still	O
promoting	O
the	O
use	O
of	O
pure	B-Application
functions	I-Application
as	O
the	O
preferred	O
way	O
to	O
express	O
computations	O
.	O
</s>
<s>
Functional	B-Language
programming	I-Language
languages	I-Language
are	O
typically	O
less	O
efficient	O
in	O
their	O
use	O
of	O
CPU	B-General_Concept
and	O
memory	O
than	O
imperative	B-Application
languages	I-Application
such	O
as	O
C	B-Language
and	O
Pascal	B-Application
.	O
</s>
<s>
This	O
is	O
related	O
to	O
the	O
fact	O
that	O
some	O
mutable	B-Application
data	B-General_Concept
structures	I-General_Concept
like	O
arrays	O
have	O
a	O
very	O
straightforward	O
implementation	O
using	O
present	O
hardware	O
.	O
</s>
<s>
It	O
is	O
also	O
not	O
easy	O
to	O
create	O
their	O
equally	O
efficient	O
general-purpose	O
immutable	B-Application
counterparts	O
.	O
</s>
<s>
For	O
purely	O
functional	B-Language
languages	I-Language
,	O
the	O
worst-case	O
slowdown	O
is	O
logarithmic	O
in	O
the	O
number	O
of	O
memory	O
cells	O
used	O
,	O
because	O
mutable	B-Application
memory	O
can	O
be	O
represented	O
by	O
a	O
purely	O
functional	O
data	B-General_Concept
structure	I-General_Concept
with	O
logarithmic	O
access	O
time	O
(	O
such	O
as	O
a	O
balanced	O
tree	O
)	O
.	O
</s>
<s>
For	O
programs	O
that	O
perform	O
intensive	O
numerical	O
computations	O
,	O
functional	B-Language
languages	I-Language
such	O
as	O
OCaml	B-Language
and	O
Clean	B-Operating_System
are	O
only	O
slightly	O
slower	O
than	O
C	B-Language
according	O
to	O
The	O
Computer	O
Language	O
Benchmarks	O
Game	O
.	O
</s>
<s>
For	O
programs	O
that	O
handle	O
large	O
matrices	B-Architecture
and	O
multidimensional	O
databases	O
,	O
array	B-Application
functional	B-Language
languages	I-Language
(	O
such	O
as	O
J	B-Language
and	O
K	B-Application
)	O
were	O
designed	O
with	O
speed	O
optimizations	O
.	O
</s>
<s>
Immutability	B-Application
of	O
data	O
can	O
in	O
many	O
cases	O
lead	O
to	O
execution	O
efficiency	O
by	O
allowing	O
the	O
compiler	B-Language
to	O
make	O
assumptions	O
that	O
are	O
unsafe	O
in	O
an	O
imperative	B-Application
language	I-Application
,	O
thus	O
increasing	O
opportunities	O
for	O
inline	O
expansion	O
.	O
</s>
<s>
Lazy	O
evaluation	O
may	O
also	O
speed	O
up	O
the	O
program	O
,	O
even	O
asymptotically	O
,	O
whereas	O
it	O
may	O
slow	O
it	O
down	O
at	O
most	O
by	O
a	O
constant	O
factor	O
(	O
however	O
,	O
it	O
may	O
introduce	O
memory	B-Error_Name
leaks	I-Error_Name
if	O
used	O
improperly	O
)	O
.	O
</s>
<s>
Launchbury	O
1993	O
discusses	O
theoretical	O
issues	O
related	O
to	O
memory	B-Error_Name
leaks	I-Error_Name
from	O
lazy	O
evaluation	O
,	O
and	O
O'Sullivan	O
et	O
al	O
.	O
</s>
<s>
It	O
is	O
possible	O
to	O
use	O
a	O
functional	O
style	O
of	O
programming	O
in	O
languages	O
that	O
are	O
not	O
traditionally	O
considered	O
functional	B-Language
languages	I-Language
.	O
</s>
<s>
For	O
example	O
,	O
both	O
D	B-Application
and	O
Fortran	O
95	O
explicitly	O
support	O
pure	B-Application
functions	I-Application
.	O
</s>
<s>
JavaScript	B-Language
,	O
Lua	B-Language
,	O
Python	B-Language
and	O
Go	B-Application
had	O
first	B-Application
class	I-Application
functions	I-Application
from	O
their	O
inception	O
.	O
</s>
<s>
Python	B-Language
had	O
support	O
for	O
"	O
lambda	B-General_Concept
"	O
,	O
"	O
map	O
"	O
,	O
"	O
reduce	B-Application
"	O
,	O
and	O
"	O
filter	B-Application
"	O
in	O
1994	O
,	O
as	O
well	O
as	O
closures	B-Language
in	O
Python	B-Language
2.2	O
,	O
though	O
Python	B-Language
3	O
relegated	O
"	O
reduce	B-Application
"	O
to	O
the	O
functools	O
standard	O
library	O
module	B-Architecture
.	O
</s>
<s>
First-class	B-Application
functions	I-Application
have	O
been	O
introduced	O
into	O
other	O
mainstream	O
languages	O
such	O
as	O
PHP	B-Application
5.3	O
,	O
Visual	B-Language
Basic	I-Language
9	I-Language
,	O
C#	B-Application
3.0	O
,	O
C++11	B-Language
,	O
and	O
Kotlin	B-Language
.	O
</s>
<s>
In	O
PHP	B-Application
,	O
anonymous	O
classes	O
,	O
closures	B-Language
and	O
lambdas	B-General_Concept
are	O
fully	O
supported	O
.	O
</s>
<s>
Libraries	O
and	O
language	O
extensions	O
for	O
immutable	B-Application
data	B-General_Concept
structures	I-General_Concept
are	O
being	O
developed	O
to	O
aid	O
programming	O
in	O
the	O
functional	O
style	O
.	O
</s>
<s>
In	O
Java	B-Language
,	O
anonymous	O
classes	O
can	O
sometimes	O
be	O
used	O
to	O
simulate	O
closures	B-Language
;	O
however	O
,	O
anonymous	O
classes	O
are	O
not	O
always	O
proper	O
replacements	O
to	O
closures	B-Language
because	O
they	O
have	O
more	O
limited	O
capabilities	O
.	O
</s>
<s>
Java	B-Language
8	O
supports	O
lambda	B-General_Concept
expressions	I-General_Concept
as	O
a	O
replacement	O
for	O
some	O
anonymous	O
classes	O
.	O
</s>
<s>
In	O
C#	B-Application
,	O
anonymous	O
classes	O
are	O
not	O
necessary	O
,	O
because	O
closures	B-Language
and	O
lambdas	B-General_Concept
are	O
fully	O
supported	O
.	O
</s>
<s>
Libraries	O
and	O
language	O
extensions	O
for	O
immutable	B-Application
data	B-General_Concept
structures	I-General_Concept
are	O
being	O
developed	O
to	O
aid	O
programming	O
in	O
the	O
functional	O
style	O
in	O
C#	B-Application
.	O
</s>
<s>
Many	O
object-oriented	B-Language
design	O
patterns	O
are	O
expressible	O
in	O
functional	B-Language
programming	I-Language
terms	O
:	O
for	O
example	O
,	O
the	O
strategy	O
pattern	O
simply	O
dictates	O
use	O
of	O
a	O
higher-order	B-Language
function	I-Language
,	O
and	O
the	O
visitor	B-Language
pattern	I-Language
roughly	O
corresponds	O
to	O
a	O
catamorphism	B-Application
,	O
or	O
fold	B-Application
.	O
</s>
<s>
Similarly	O
,	O
the	O
idea	O
of	O
immutable	B-Application
data	O
from	O
functional	B-Language
programming	I-Language
is	O
often	O
included	O
in	O
imperative	B-Application
programming	I-Application
languages	I-Application
,	O
for	O
example	O
the	O
tuple	O
in	O
Python	B-Language
,	O
which	O
is	O
an	O
immutable	B-Application
array	B-Application
,	O
and	O
Object.freeze( )	O
in	O
JavaScript	B-Language
.	O
</s>
<s>
Spreadsheets	B-Application
can	O
be	O
considered	O
a	O
form	O
of	O
pure	O
,	O
zeroth-order	B-Language
,	O
strict-evaluation	O
functional	B-Language
programming	I-Language
system	O
.	O
</s>
<s>
However	O
,	O
spreadsheets	B-Application
generally	O
lack	O
higher-order	B-Language
functions	I-Language
as	O
well	O
as	O
code	O
reuse	O
,	O
and	O
in	O
some	O
implementations	O
,	O
also	O
lack	O
recursion	O
.	O
</s>
<s>
Several	O
extensions	O
have	O
been	O
developed	O
for	O
spreadsheet	B-Application
programs	I-Application
to	O
enable	O
higher-order	O
and	O
reusable	O
functions	O
,	O
but	O
so	O
far	O
remain	O
primarily	O
academic	O
in	O
nature	O
.	O
</s>
<s>
Functional	B-Language
programming	I-Language
is	O
an	O
active	O
area	O
of	O
research	O
in	O
the	O
field	O
of	O
programming	O
language	O
theory	O
.	O
</s>
<s>
There	O
are	O
several	O
peer-reviewed	O
publication	O
venues	O
focusing	O
on	O
functional	B-Language
programming	I-Language
,	O
including	O
the	O
International	O
Conference	O
on	O
Functional	B-Language
Programming	I-Language
,	O
the	O
Journal	O
of	O
Functional	B-Language
Programming	I-Language
,	O
and	O
the	O
Symposium	O
on	O
Trends	O
in	O
Functional	B-Language
Programming	I-Language
.	O
</s>
<s>
Functional	B-Language
programming	I-Language
has	O
been	O
employed	O
in	O
a	O
wide	O
range	O
of	O
industrial	O
applications	O
.	O
</s>
<s>
For	O
example	O
,	O
Erlang	B-Operating_System
,	O
which	O
was	O
developed	O
by	O
the	O
Swedish	O
company	O
Ericsson	O
in	O
the	O
late	O
1980s	O
,	O
was	O
originally	O
used	O
to	O
implement	O
fault-tolerant	B-General_Concept
telecommunications	O
systems	O
,	O
but	O
has	O
since	O
become	O
popular	O
for	O
building	O
a	O
range	O
of	O
applications	O
at	O
companies	O
such	O
as	O
Nortel	O
,	O
Facebook	B-Application
,	O
Électricité	O
de	O
France	O
and	O
WhatsApp	B-Application
.	O
</s>
<s>
Scheme	B-Language
,	O
a	O
dialect	O
of	O
Lisp	B-Language
,	O
was	O
used	O
as	O
the	O
basis	O
for	O
several	O
applications	O
on	O
early	O
Apple	B-Device
Macintosh	I-Device
computers	I-Device
and	O
has	O
been	O
applied	O
to	O
problems	O
such	O
as	O
training-simulation	O
software	O
and	O
telescope	O
control	O
.	O
</s>
<s>
OCaml	B-Language
,	O
which	O
was	O
introduced	O
in	O
the	O
mid-1990s	O
,	O
has	O
seen	O
commercial	O
use	O
in	O
areas	O
such	O
as	O
financial	O
analysis	O
,	O
driver	B-Application
verification	O
,	O
industrial	O
robot	B-Algorithm
programming	O
and	O
static	O
analysis	O
of	O
embedded	B-Application
software	I-Application
.	O
</s>
<s>
Haskell	B-Language
,	O
though	O
initially	O
intended	O
as	O
a	O
research	O
language	O
,	O
has	O
also	O
been	O
applied	O
in	O
areas	O
such	O
as	O
aerospace	O
systems	O
,	O
hardware	O
design	O
and	O
web	O
programming	O
.	O
</s>
<s>
Other	O
functional	B-Language
programming	I-Language
languages	I-Language
that	O
have	O
seen	O
use	O
in	O
industry	O
include	O
Scala	B-Application
,	O
F#	B-Operating_System
,	O
Wolfram	B-Language
Language	I-Language
,	O
Lisp	B-Language
,	O
Standard	B-Language
ML	I-Language
and	O
Clojure	B-Language
.	O
</s>
<s>
Given	O
the	O
use	O
of	O
OCaml	B-Language
and	O
Caml	B-Language
variations	O
in	O
finance	O
,	O
these	O
systems	O
are	O
sometimes	O
considered	O
related	O
to	O
a	O
categorical	B-Application
abstract	I-Application
machine	I-Application
.	O
</s>
<s>
Functional	B-Language
programming	I-Language
is	O
heavily	O
influenced	O
by	O
category	O
theory	O
.	O
</s>
<s>
Many	O
universities	O
teach	O
functional	B-Language
programming	I-Language
.	O
</s>
<s>
Some	O
treat	O
it	O
as	O
an	O
introductory	O
programming	O
concept	O
while	O
others	O
first	O
teach	O
imperative	B-Application
programming	I-Application
methods	O
.	O
</s>
<s>
Outside	O
of	O
computer	B-General_Concept
science	I-General_Concept
,	O
functional	B-Language
programming	I-Language
is	O
used	O
to	O
teach	O
problem-solving	O
,	O
algebraic	O
and	O
geometric	O
concepts	O
.	O
</s>
