I tried flatten in Ruby with Python
flatten.py
def flatten(l):
ret = []
for a in l:
if hasattr(a,'__iter__'):
ret += flatten(a)
else:
ret.append(a)
return ret
Recommended Posts