What the Functional Programs do
Have first-class functions: First-class functions are functions that can be
passed around, dynamically created, stored in data structures, and
treated like any other first-class object in the language.
Favor pure functions: Pure functions are functions that have no side effects.
A side effect is an action that the function does that modifies state outside
the function.
Compose functions: Functional programming favors building programs from
the bottom up by composing functions together.
Use expressions: Functional programming favors expressions over statements.
Expressions yield values. Statements do not and exist only to control the
flow of a program.
Use Immutability: Since functional programming favors pure functions, which
can’t mutate data, it also makes heavy use of immutable data. Instead of
modifying an existing data structure, a new one is efficiently created.
Transform, rather than mutate, data: Functional programming uses functions
to transform immutable data. One data structure is put into the function,
and a new immutable data structure comes out. This is in explicit contrast
with the popular object-oriented model, which views objects as little
packets of mutable state and behavior.
passed around, dynamically created, stored in data structures, and
treated like any other first-class object in the language.
Favor pure functions: Pure functions are functions that have no side effects.
A side effect is an action that the function does that modifies state outside
the function.
Compose functions: Functional programming favors building programs from
the bottom up by composing functions together.
Use expressions: Functional programming favors expressions over statements.
Expressions yield values. Statements do not and exist only to control the
flow of a program.
Use Immutability: Since functional programming favors pure functions, which
can’t mutate data, it also makes heavy use of immutable data. Instead of
modifying an existing data structure, a new one is efficiently created.
Transform, rather than mutate, data: Functional programming uses functions
to transform immutable data. One data structure is put into the function,
and a new immutable data structure comes out. This is in explicit contrast
with the popular object-oriented model, which views objects as little
packets of mutable state and behavior.