Functional programming languages are specially designed to handle symbolic computation and list processing applications. Functional programming is based on mathematical functions. Some of the popular functional programming languages include: Lisp, Python, Erlang, Haskell, Clojure, etc.
Functional programming languages are categorized into two groups, i.e. −
Pure Functional Languages − These types of functional languages support only the functional paradigms. For example − Haskell.
Impure Functional Languages − These types of functional languages support the functional paradigms and imperative style programming. For example − LISP.
The characteristics of functional programming are as follows −
Functional programming languages are designed on the concept of mathematical functions that use conditional expressions and recursion to perform computation.
Functional programming supports higher-order functions and lazy evaluation features.
Functional programming languages don’t support flow Controls like loop statements and conditional statements like If-Else and Switch Statements. They directly use the functions and functional calls.
Like OOP, functional programming languages support popular concepts such as Abstraction, Encapsulation, Inheritance, and Polymorphism.
Functional programming offers the following advantages −
Bugs-Free Code − Functional programming does not support state, so there are no side-effect results and we can write error-free codes.
Efficient Parallel Programming − Functional programming languages have NO Mutable state, so there are no state-change issues. One can program "Functions" to work parallel as "instructions". Such codes support easy reusability and testability.
Efficiency − Functional programs consist of independent units that can run concurrently. As a result, such programs are more efficient.
Supports Nested Functions − Functional programming supports Nested Functions.
Lazy Evaluation − Functional programming supports Lazy Functional Constructs like Lazy Lists, Lazy Maps, etc.
As a downside, functional programming requires a large memory space. As it does not have state, you need to create new objects every time to perform actions.
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.
Embedded Lisp interpreters add programmability to some systems like Emacs.