Created
February 5, 2018 11:21
-
-
Save meddle0x53/36d0bf3f708fdc6d8f22a4b8fb137016 to your computer and use it in GitHub Desktop.
Simpler flatten
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def flatten([head | tail], result) when is_list(head), do: flatten(head, flatten(tail, result)) | |
| def flatten([head | tail], result), do: [head | flatten(tail, result)] | |
| def flatten([], result), do: result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment