About
In Functional programming (FP), you will pass functions to other functions as parameters.
It is a declarative paradigm that treats computation as the evaluation of mathematical functions.
With functional programming (FP), the code is organized around:
- pure functions that take data and transform it, without modifying any shared state.
- around how data flows between these pure functions to produce output data.
Imperative vs Functional
imperative vs Functional 1)
Features
Composition: Algebraic data type
The application of several function programming operations creates a composite type called a Algebraic data type
In the same vein that SQL,
- some operation defines a logical plan (meaning that you build a metadata object, there is no data movement)
- some operation triggers the execution (generally known as the terminal operation).
Reproducibility
Multiple invocations of a function at different points in time will always return the same output as long as the input remains the same. It makes it easy to understand and predict the behavior of the program.
Data Concurrency Simplification
The five collection operations functions hold a key to simplifying asynchronous programming and avoiding race conditions, propagating and handling asynchronous errors, and sequence events and requests.
Collections Function Operations
Functional programming defines standard functions on collections.
Most of the operations, you perform on collections can be accomplished with this five pure functions:
- mergeAll
- zip
Others functions:
Language
Nix
Nix is a pure function language.
Java
JVM based Functional Programming Languages
- Clojure
- Groovy
Library
- ReactiveX - ReactiveX: A library for composing asynchronous and event-based programs using observable sequences for the Java VM, Javascript
- https://ramdajs.com/ - Javascript