This commit is contained in:
2024-06-26 23:30:11 -04:00
parent b62fcbc5ea
commit 10cfc2215b
10 changed files with 344 additions and 0 deletions

16
elixir/etl/lib/etl.ex Normal file
View File

@@ -0,0 +1,16 @@
defmodule ETL do
@doc """
Transforms an old Scrabble score system to a new one.
## Examples
iex> ETL.transform(%{1 => ["A", "E"], 2 => ["D", "G"]})
%{"a" => 1, "d" => 2, "e" => 1, "g" => 2}
"""
@spec transform(map) :: map
def transform(input) do
for {score, letters} <- input, letter <- letters, into: %{} do
{String.downcase(letter), score}
end
end
end