elm/exercises/etl/Etl.example.elm
2017-07-07 21:08:40 -04:00

15 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