#!/usr/bin/python3
"Example how to program in Python the Functional way"
from functools import reduce

def Look_and_Say(n):
    "Produce next element of John Horton Conway's Look-and-say sequence"
    return int("".join(map(str,reduce(lambda s, c: int(c) == s[-1] and s[:-2]+[s[-2]+1,s[-1]] or s+[1,int(c)], str(n)[1:], [1,int(str(n)[0])]))))

print("\n".join(["%d %d"%c for c in reduce(lambda l, n: l+[(n, Look_and_Say(l[-1][1]))], list(range(2,11)), [(1,1)])]))
