mirror of
https://github.com/correl/elm.git
synced 2024-12-23 11:15:00 +00:00
16 lines
412 B
Elm
16 lines
412 B
Elm
|
module Etl exposing (transform)
|
||
|
|
||
|
import Dict exposing (Dict)
|
||
|
|
||
|
|
||
|
transform : Dict Int (List String) -> Dict String Int
|
||
|
transform input =
|
||
|
Dict.foldl addLetters Dict.empty input
|
||
|
|
||
|
|
||
|
addLetters : Int -> List String -> Dict String Int -> Dict String Int
|
||
|
addLetters score letters output =
|
||
|
letters
|
||
|
|> List.map String.toLower
|
||
|
|> List.foldl (\letter output -> Dict.insert letter score output) output
|