Created
February 23, 2020 08:54
-
-
Save eviltofu/28950054df4e1bd2cbbc8a3c928e7724 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 Work do | |
@spec all_face_cards?(list()) :: boolean() | |
def all_face_cards?(list) when is_list(list) do | |
list |> Enum.all?(&face_card?/1) | |
end | |
@spec face_card?(integer()) :: boolean() | |
def face_card?(1), do: true | |
def face_card?(x) when x >= 10 and x <= 13, do: true | |
def face_card?(_), do: false | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment