Skip to content

Instantly share code, notes, and snippets.

@eviltofu
Created February 23, 2020 08:54
Show Gist options
  • Save eviltofu/28950054df4e1bd2cbbc8a3c928e7724 to your computer and use it in GitHub Desktop.
Save eviltofu/28950054df4e1bd2cbbc8a3c928e7724 to your computer and use it in GitHub Desktop.
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