Docs itertools recipe applied to pack. Plus tests.