Functional Programming
Functional programming
Functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids changing-state and mutable data. It emphasizes the application of functions, often as first-class citizens, and the use of immutable data structures.
Some arguments in favor of functional programming
Functional programming languages emphasize rules and pattern-matching. While they appear non-intuitive to those who have only experienced procedural languages, they provide succinct and natural programming structures for those who gain some experience. Functional programming is particularly useful for mathematical work, where the notion of function
is already a well established concept.
It was true that functional programs generally ran more slowly than procedural programs. However, runtime is not the whole story in terms of efficiency. The time it takes to develop code, and even more importantly, to modify programs, is substantially faster for functional programs than for procedural programs. This is important for protyping and carrying out exploratory research.
An additional factor that needs to be taken into account when evaluating the efficiency of a language for computer simulation work is related to what computing tasks are going to be carried out.
Functional programming constructs allow you to do many things in one line that would normally take several loops in other languages. When you add Fold[] and Nest[] into the mix, you can do some pretty powerful things in a couple of lines.
According to functional programming community, if you aren’t programming functionally, you’re programming dysfunctionally!