You can run the tests with elixir flatten_test.exs
:
$ elixir flatten_test.exs
FlattenTest
* test nested array 2 (0.00ms)
* test empty array (0.00ms)
* test nested array 3 (0.00ms)
* test nested array 1 (0.00ms)
* test one element (0.00ms)
* test non-nested array (0.00ms)
* test nested array 4 (0.00ms)
Finished in 0.04 seconds (0.04s on load, 0.00s on tests)
7 tests, 0 failures
Randomized with seed 969009
The above may overflow the stack.
See tail recursion version that I wrote: https://gist.github.com/heri16/e726ee7f335d2ca61bbbb016e6b884e1