Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When to use a functional programming language? [closed]

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?

like image 691
Alex Baranosky Avatar asked Dec 29 '08 10:12

Alex Baranosky


People also ask

When should a functional programming language be used?

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.

Are closures used in functional programming?

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.

What is closure language used for?

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.

Where can we use functional programming?

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#.


1 Answers

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.

like image 91
Alex Baranosky Avatar answered Oct 04 '22 00:10

Alex Baranosky