Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Is functional programming so related to mathematics because much of the functional programming is depicted with mathematical notions? Is it a MUST to have a strong base of maths to learn & understand functional programming for a programmer with a imperative background?

share|improve this question

migrated from stackoverflow.com Mar 21 '11 at 8:30

This question came from our site for professional and enthusiast programmers.

Is this question correctly tagged with mathematica or should it be math? –  Sjoerd C. de Vries Mar 21 '11 at 7:14
Here and here are two very similar questions. I don't think you have to have a 'strong base' in math but you need a fairly good understanding of it's principles from some point of view. Geometry helps me the most with memory mapping, but I rarely think of the numbers as such much anymore. Math is (can be) VERY useful though. –  Garet Claborn Mar 21 '11 at 9:14

5 Answers 5

up vote 23 down vote accepted

All programming is related to mathematics. Indeed many universities still place their computer science programs under the purview of the mathematics department.

As for learning functional programming, you do not need to have a strong base in mathematics to learn it. I've learnt three different functional languages now to reasonable proficiency (Haskell, Erlang, Clojure) and my own maths skills are extremely weak. Haskell's community can, indeed, get a little bit annoying in its maths-focused way of speaking about things, but Erlang and Clojure both are very pragmatic functional programming languages that are not that hard to pick up because the tutorial information is written, seemingly, for programmers, not hard-core maths geeks. That being said, despite my handicap in maths I did pick up Haskell, so it's not impossible.

The real difficulty I've found in picking up declarative programming languages in general (of which functional is a subset) is giving up that urge to be in control; to tell the computer what to do. It takes some getting used to.

share|improve this answer
Nice words, +1. –  Mudassir Mar 21 '11 at 9:18
when you get to learn SQL well declarative programming is not so hard. –  user1249 Apr 16 '11 at 19:45

not really. functional programming is just a methodology, but it had its base in lambda calculus and stuff like that.

Closures are a (small) attempt to introduce functional programming concepts into procedural languages. instead of for(int i =0 ; i < num; i++) doStuff(arr[i]);, you can instead assume that the elements of the array inherently can have "stuff done to them" so arr.each do |el| doStuff(el) end

share|improve this answer
You're only exemplifying an anonymous function, not the closure. Wikiedpia: The term closure is often mistakenly used to mean anonymous function. This is probably because most languages implementing anonymous functions allow them to form closures and programmers are usually introduced to both concepts at the same time. These are, however, distinct concepts. A closure retains a reference to the environment at the time it was created (for example, to the current value of a local variable in the enclosing scope) while a generic anonymous function need not do this. –  Jakob Mar 21 '11 at 7:13

IMO Mathematica, as an example of a language in which you can use functional programming, does not require a strong background in math. In fact, I don't think I encountered anything like functional programming during my basic math education. I started Mathematica programming doing C-style, and discovered functional programming only years later. I don't think the basic functional programming constructs like Map, Apply, NestList, etc require any math background at all.

share|improve this answer

Yes. Essentially, a functional program is a bunch of statements like that:

// 1_ and 2_ are "dummy arguments" f(1_) := sin(1_) g(1_,2_) := 1_ + 2_ etc...

x = f()

y = g(x)

z = h(x, h2(y))


You are writing what the program is supposed to do in a form of equations defining new values (note: not variables) as functions of previously defined values. You also define the functions as relations. It is really quite similar to the way mathematical theorems are written.

share|improve this answer

The short answer is: Yes, because everything with a certain degree of formalization (such as programming languages) is strongly related to mathematics, for varying degrees of mathematics.

But, using a programming language does not strictly require familiarity with mathematics, for example theroetical foundations of languages. You don't have to know what a context free language is and what laws and property such a language has in order to use one. Likewise, you don't have to be a Germanist or Romanist to speak german or french.

The "mathematical" notation is not a common property of functional languages. Scala and all Lisp based languages have very different syntaxes compared to Haskell.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.