Created
February 10, 2021 16:16
-
-
Save kevinkirkup/6c7ee3b1c00eeeb5348aea9c7e5f5bda to your computer and use it in GitHub Desktop.
This file contains 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 HW1 do | |
def flatten([]), do: [] | |
def flatten([head | []]), do: [head] | |
def flatten([[head] | [tail]]), do: [head | flatten(tail)] | |
def flatten([head | [tail]]), do: [head | flatten(tail)] | |
def flatten([head | tail]), do: [head | flatten(tail)] | |
def flatten(head), do: [head] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment