Thu 16 Nov 2006
I’ve started working on a functional programming cookbook to illustrate practical uses for my functional package. So far I’ve got three examples up, with more on the way:
-
Since functional’s shipped version of
compose()only allows you to compose two functions, the cookbook includes a version ofcompose()that accepts multiple functions. -
I tend to use a heavily-functional style when writing
__hash__()implementations, so I’ve included an example of how to do that using functional. -
Last but not least is a
join()function that works like Python’s"".join(...)idiom, except that it automatically stringifies its arguments.
I’ve got some more examples in the works, including an explanation of when you should use the built-in reduce() over foldl() and vice-versa. Keep watching the cookbook for these and future Python functional programming goodies.