Line numbering a file with reduce is straightforward:
def line_number_catamorphism(fp):
def accumulate(a, line):
line_number, lines = a
return line_number + 1, lines + [(line_number + 1, line)]
return reduce(accumulate, fp, (0, []))[1]
It may be worth nothing that zip can be straightforwardly expressed in terms of map as well, i.e.: zip = lambda *a: map(None, *a)