elm/exercises/etl/Etl.example.elm

16 lines
412 B
Elm
Raw Normal View History

2017-05-29 00:41:40 +00:00
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