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.

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

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

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.

  • 5
    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. – sara Jun 14 '16 at 10:07

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