test of function closures and a bad 'reduce' implementation