Created
June 28, 2017 15:31
-
-
Save ronaldofs/ed3dc38f658e408fb723f84db9485d12 to your computer and use it in GitHub Desktop.
Flatten lists
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
| defmodule Flattener do | |
| def flatten([head|tail]), do: flatten(head) ++ flatten(tail) | |
| def flatten([]), do: [] | |
| def flatten(value), do: [value] | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment