Stampy

Dev Blog

Functional Concepts for Practical Coders

ActionScript and JavaScript support a lot of fancy concepts like closures, partial application, filter chaining, and function composition. Without a background in functional programming, it might not be clear to you what those things are, or why you’d want to use any of it. Wikipedia is too dense, functional programming language tutorials are too mathematical, Haskell is too weird-looking, and more to the point, why would you want to use any of this stuff instead of clear and simple loops, variables, and inheritance? Why make your code more complicated? Why confuse your fellow coders with weird programming paradigms? Why write functions that make functions that make functions when you could just, you know, write a function?

I’ve written a blog series to convince you otherwise.

These concepts can be added to everyday code without twisting it into some confusing recursive sculpture, and they can make common tasks easier, faster, and even produce more readable code. The first four posts use examples written in ActionScript, but the concepts are precisely identical in JavaScript; they even use the same library, underscore.js and my AS3 port underscore.as.

Read the whole series here. If you find it helpful (or confusing), let me know.

Comments