On Functional Programming...

Posted September 27, 2010

Many people keep saying that Python or Ruby promote functional programming just because you can pass functions as values. Actually, you can do that in C since 1978.

Alright, these two languages have some features that are also present in functional programming languages and in fact it's not easy to define exactly what functional programming is, but remember that functional programming is declarative as opposed to imperative. (See Programming Language Pragmatics by Michael L. Scott). So, here is a nice quote that describes what functional programming is not:

  • "A Programming Language that is characterized by these three properties - the sequential execution of instructions, the use of variables representing memory locations, and the use of assignment to change the values of variables - is called an imperative language, since its primary feature is a sequence of statements that represents commands, or imperatives."

    Programming Languages: Principles and Practice by Kenneth C. Louden

To summarize: if you assign variables then you are probably not doing functional programming. It's that easy.