Functional Programming – Why Are Tutorials So Math-Heavy?

functional programmingmath

I've been trying to learn functional programming and most tutorials I have found use math as examples for the more complicated constructs (even the simple ones in some cases). Why is this? I would imagine something easier could be used. Its making it difficult to learn.

Background Info:
I have been writing software for 12 years. I understand some of the concepts such as closures, functions as first class citizens, and generics. I may be having problems with higher-order functions at some advanced level, but I would like to believe I have a basic grasp. Monads are biting me in the butt, and at this point I haven't gotten past that (I'm sure I will eventually, because I'm persistent).

Best Answer

They use math because Functional Programming is very good at modelling mathematical constructs and is very tied into mathematical concepts, particularly Lambda Calculus. Also since I/O is typically a fairly thorny and advanced subject in a lot of languages of the functional paradigm mathematics via the REPLs of the various languages becomes a good way of teaching the language at first.

Because Functional Programming treats Functions as first class constructs within the programming language, function generation becomes very important. Therefore higher math becomes fairly important particularly graph theory.

Imperative Languages are just as mathy but it's all arithmetical at base since they are closer to the machine which can only add anyway. Functional languages with their higher abstraction tend more toward mathematics. The general use in academia doesn't help either as they get used and thus taught by people who know a lot of math and are teaching people who are expect to learn a lot of math. So it's possible to "dumb it down" so to speak but it is unlikely given these factors.

http://learnyouahaskell.com/ - Is probably one of the gentlest introductions to Functional Programming, I double checked and there's nothing beyond basic algebra and graph theory in there.