27 lines
519 B
Elixir
27 lines
519 B
Elixir
defmodule Pangram do
|
|
@doc """
|
|
Determines if a word or sentence is a pangram.
|
|
A pangram is a sentence using every letter of the alphabet at least once.
|
|
|
|
Returns a boolean.
|
|
|
|
## Examples
|
|
|
|
iex> Pangram.pangram?("the quick brown fox jumps over the lazy dog")
|
|
true
|
|
|
|
"""
|
|
|
|
@alphabet Enum.to_list(?A..?Z)
|
|
|
|
@spec pangram?(String.t()) :: boolean
|
|
def pangram?(sentence) do
|
|
letters =
|
|
sentence
|
|
|> String.upcase()
|
|
|> String.to_charlist()
|
|
|
|
@alphabet -- letters == []
|
|
end
|
|
end
|