Updated functions section

* Added missing sample code
* Added section on functional programming

I believe this resolves #2. @bridgethillyer, what do you think?