functional

functional provides Python users with numerous tools common in functional programming, such as foldl, foldr, flip, as well as mechanisms for partial function application and function composition.

functional comes in two flavours: one is written in a combination of C and Python, focusing on performance. The second is written in pure Python and emphasises code readability and portability. The pure-Python variant is also recommended if your setup does not allow compilation of third-party extension modules.

Interested? Grab the latest version.

News

29 July 2006

functional 0.7 has been released. This release sees several reference counting errors fixed, plus the introduction of two new functions: sane, predictable versions of the Python built-ins map() and filter(). For details as to why it was felt necessary to reimplement these functions, see the documentation.

Also: the C implementation now compiles against Python 2.3 and the test suite has been enhanced with more fine-grained detection of reference counting errors.

27 Apr 2006

functional 0.6 has been released. In addition to a number of small performance enhancements and tiddying-up, this release sees the implementation of two highly-requested features:

  • flip now flips all arguments to the callable, not just the first two.

  • compose now takes an optional unpack argument. compose(f, g, unpack=True) is equivalent to f(*g(...)).

02 Feb 2006

functional 0.5 has been released. With this latest release, functional has grown a performance-focused C implementation to complement the pure-Python version. In addition, a number of functions have been removed from functional because of their overlap with the standard itertools module.

functional