In which situations should I choose to use a functional programming language over a more verbose object-oriented language like C++, C# or Java?
I understand what functional programming is, what I don't really understand is for what types of problems is it a perfect solution?
Functional Programming is used in situations where we have to perform lots of different operations on the same set of data. Lisp is used for artificial intelligence applications like Machine learning, language processing, Modeling of speech and vision, etc.
Functional programming languages (for e.g. LISP etc.) use closures extensively. In case of JavaScript, one practical and common usage of closures is in the usage of data hiding (we will see how data hiding works in the JavaScript world with the usage of closures) or in callbacks.
Clojure is being used extensively for processing large volumes of data. It is very well suited to data mining/commercial-AI (ie: Runa) and large scale predictions (aka WeatherBill). Clojure's concurrency story really helps in these data heavy domains where parallel processing is simply the only answer.
Functional programming has historically been less popular than imperative programming, but many functional languages are seeing use today in industry and education, including Common Lisp, Scheme, Clojure, Wolfram Language, Racket, Erlang, Elixir, OCaml, Haskell, and F#.
I've done some research into this myself and thought I might add CONCURRENCY to the list of reasons to use a functional language. See at some point in the near future processor speed will not be able to increase using the same cpu technology. The physics of the architecture won't allow it.
So that is where concurrent processing comes in.
Unfortunately most OOP languages cannot take advantage of multiple processors at once because of the interdependencies between data.
In pure functional programming languages the computer can run two (or many more) functions at once because those functions are not altering outside state information.
Here is an excellent article on functional programming you may enjoy.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With