I have this kind of list:

[[[[{a,2},{s,w}],{e,1}],{d,l}]]

Is there a function that will remove all of the tuples so they are all on the same level? Like:

[{a,2},{s,w},{e,1},{d,l}]

Thanks

有帮助吗?

解决方案

You can use flatten/1 from the lists module.

lists:flatten([[[[{a,2},{s,w}],{e,1}],{d,l}]]).
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top