March 4th 2008 Functional Programming in Python
I’ve been experimenting with some functional programming in Python. I haven’t done anything fancy yet, but below is a recursive implementation of the Haskell function foldl in Python. I could’ve written it iteratively, but by writing it recursively, I avoided the need to store any data in variables, thus making it more “purely functional”.
It’s nothing amazing, but I was quite pleased with my efforts.