Programming with functions
In IP (no address), you think in terms of instructions.
It's about functions the way imperative programming is about instructions.
In FP, you think in terms of functions and what they return.
Functional programming (like OOP) has no strict definition. It's a collection of ideas.
A philosophy, if you will.
Some programming languages - many actually - identify as Functional Languages.
Scala, Haskell, Lisp, Scheme, Clojure,
ML, OCaml, Erlang, Elm, Idris, the list goes off.
Functions are first class citizens. Meaning that everything you can do with “data” can be done with functions.
Recursion favored over loops. In some languages, there are no "loop" constructs. I see you Haskell.
“Higher order” functions: functions that operate on functions and return functions.
Functional programming frowns upon side effects.
Functional programming either discourages or outright disallows statements, and instead works with the evaluation of expressions
Functional programming worries about what is to be computed rather than how it is to be computed.
sum = 0
xs = [1, 4, 2, 7.8, 42]
for i in xs:
sum += ifrom operator import add
xs = [7.8, 32, 2.2]
sum = reduce(add, xs)git clone https://github.com/letroot/python-fp.git