What is Functional Programming (FP) about? This is the shortest description I can come up with.

1. Immutable Data

Never change data. Just wrap and extend old data to create new data.

2. Pure Functions

Functions must not change on global state. They might depend on global state, but that state is immutable.

3. First-Class Functions

Dynamically create new functions. This enables partial evaluation / currying.

Intentionally Left Out

FP is not about monads or lazyness, although Haskell makes you think that.

It is not about static-typing or type-inference, although most research in this field is in FP languages. Their semantics are just simpler to write about.

It is not about higher-order functions or recursion. This is possible in C just as well. FP requires recursion to express loops.

Referential transparency is a property which follows from immutable data and pure functions.

© 2012-06-25
qznc