Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

closed as too broad by MichaelT, gnat, JB King Dec 4 '15 at 18:16

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

"List of" questions where each answer is equally valid aren't suited to the Stack Exchange format. What specific problem are you trying to solve here? – ChrisF Oct 11 '11 at 22:14
up vote 9 down vote accepted

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.

share|improve this answer
I really think this is a myth that refuses to die. Even in a pure functional language like Haskell, causing side effects isn't hard at all. The difference is that side effects are explicit in the type system. I also think that "generates an output without a need for side effects" is self-contradicting. Generating output is a side-effect. In Haskell this is done in the IO monad for example. This doesn't mean that IO is "hard" in Haskell. – kai Jun 14 at 10:07

Not the answer you're looking for? Browse other questions tagged or ask your own question.