Improve environment #1

This commit is contained in:
Bartłomiej Pluta
2019-07-04 11:43:07 +02:00
parent ce101df380
commit b60dedc769
16 changed files with 28 additions and 8 deletions

View File

@@ -0,0 +1,19 @@
from functools import reduce
def combine(args, env):
if all(type(x) == list for x in args):
return reduce((lambda x, y: x + y), args)
def flat(args, env):
return _flat(args, [])
def _flat(input, output = []):
for item in input:
if type(item) == list:
_flat(item, output)
else:
output.append(item)
return output