Add fold function.

Handy to have around.