Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Pointless? solution in Creative category for Digit Stack by veky
def digit_stack(commands):
import functools, itertools
stack=[]
def push(x):
stack.append(x) and (yield)
def pop():
if stack:
yield stack.pop()
def peek():
if stack:
yield stack[-1]
return sum(itertools.chain.from_iterable(functools.partial(*(
eval(arg.lower()) for arg in command.split() if (push, pop, peek)
))() for command in commands))
July 31, 2014
Comments: