Saturday, July 15, 2006

Grok the Functional


"Functional Programming" is a term I've been long accustomed to hearing and generalizing about, but whoever is at the end of defmarco has done a great job in this essay of unpacking the basics of Functional Programming for those of us who never encountered it in an academic setting. I found it referenced via John Lam.

The essay sweeps through the logic and ideas of Plato, the geniuses at Princeton who started thinking in lambda expressions, and John McCarthy's innovation at MIT of LISP. From there a case is made for the benefits of Functional Programming along the following lines:

1. Unit Testing
2. Debugging
3. Concurrency
4. Hot Code Deployment
5. Machine Assisted Proofs and Optimizations

The latter part of the essay is defmarco explaining the basics of Functional Programming. Even though the essay is "for the rest of us" I admit that the differing style from what I'm used to in impatrive style did require frequent stopping and mulling. But it's well written and very accessible in its explanation of some of the fundamentals:

1. High Order Functions - functions operating on other functions
2. Currying - reusing functions by assignment
3. Lazy Evaluation - evaluation as needed
4. Infinite Data Structures - based on functions
5. Continuations - like the stack, but oh so powerful
6. Pattern Matching - functions match calls based on parameter values matching
7. Closures - state management function to function

Great essay, well worth the time and effort.


No comments: