6

Which problems domains are more suited to functional programming solutions and why? Can anyone provide any examples?

EDIT Just to clarify, I'm not asking for a list of problems. I want to know what type of problems are best suited to functional solutions. For example I have heard financial problems are solved well with functional programming.

genesis
  • 205
Tom Squires
  • 17,835

1 Answers1

10

Functional programming uses immutable datastructures and doesn't rely on mutable state, this means that the programs are easier to reason about and easier to prove for correctness.

Functional programming is easiest to use for stateless problems, e.g. programs that takes an input and generates an output without a need for side effects. Typical problem domains are compilers and stateless servers. Or libraries for calculations.

Jonas
  • 14,887
  • 10
  • 70
  • 103