July 11, 2006 tools

Functional Language Summary

I’ve been hearing a lot about functional programming lately (and the circle of life continues); I found Functional Programming For The Rest of Us to be a nice summary. Here’s what I got from it:

Atoms of FP:

  • All variables” are immutable, often called symbols”
  • Program state is kept in functions (specifically, arguments passed on the stack to functions), not variables
  • Functions are first class citizens, i.e. functions can be passed as arguments
  • currying” is a convenience syntax for adapting a function to an alternate function signature
  • closures” are functions that are allowed mutable state and access to state outside their lexical scope to bridge functional and non-functional languages


  • Functions cannot cause side effects (“variables” are immutable)
  • FP is great for unit testing (only have to test outputs against inputs — don’t have to test side effects)
  • FP is great for debugging (no need to worry about external state affecting function results — results are only based on the input)
  • No need for multi-threaded locks, as state is immutable
    • This makes functional programs automatically parallelizeable
  • Can hot swap new function definitions w/o effecting existing instances
  • Don’t need to evaluate a function til the results are needed

FP sounds great! Why do we mess around w/ anything else?!?