etl
This commit is contained in:
16
elixir/etl/lib/etl.ex
Normal file
16
elixir/etl/lib/etl.ex
Normal 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
|
||||
Reference in New Issue
Block a user