As above. Any simple explanation?
Many languages have functions, procedures, routines or methods too.
functional programming language are like Lisp, Erlang, Haskell, Scheme, Ocaml. follows in a free side effect manner, they are based on a mathematical programming concept from Lambda Calculus.
When I meant side effect,
"a = 1" return value is 1, the operation of "a" begin assigned with 1 is a side effect.
Functional languages emphasis on the idea of input(s) provided to a function to produce an output. Which is why you will notice a lot of functional languages have the behaviour of wrapping on function into another f(g(h()))
This functional behaviour do exhibit in different forms, like in Lisp, they exist as
(OPERATOR OPERAND OPERAND .... OPERAND)
such as
(CAR (CDR <LIST>))
You will want to first study on Lambda Calculus to get a feel of how functional programming concept works.
For proper programming languages terminology,
PROCEDURE is a list of imperative steps to programming. These steps transit via side effects, not necessarily in a functional manner.
METHOD is an action onto the INSTANCE/OBJECT. This relationship is part of OOPL.
FUNCTION found in any programming languages can be functional, but it can be not in this manner too. Imperative programming languages normally just describe it as a set of statements that eventually return a value.
FUNCTIONAL in functional languages, the focus on side effect free, which is useful to immutability.
Take simple arithmetic operations like
1 + 2 * 3 - 4
The functional approach will be to visualise it in postfix functional form as such
(- (+ 1 (* 2 3)) 4)
Functional programming languages also have one very distinctive feature, known as lazy evaluation. On the other hand, Imperative programming languages are mostly eager evaluation.
In C for eg:
F(H())
H() is always eagerly evaluated before placed as input for F,
For functional languages, F is evaluated using H() as input, but H() will only be evaluated(or in lambda calculus term "reduce"), only when applied on runtime inside F. Effectively there could be a divide by zero error existing in H() that is never evaluated if it is never applied inside F. This is a form of closure feature found in programming languages