Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Composition of Functions solution in Creative category for Easy Unpack by flpo
from functools import partial, reduce
from itertools import cycle
from operator import itemgetter
compose = lambda *funcs: lambda x: reduce(lambda y, f: f(y), reversed(funcs), x)
zip_apply = lambda fs, values: (f(value) for f, value in zip(fs, values))
wrap = lambda x: [x]
unpack = partial(zip_apply, tuple(map(itemgetter, (0, 2, -2))))
easy_unpack = compose(tuple, unpack, cycle, wrap)
Oct. 10, 2017
Comments: