Other Elm solutions.
module Etl exposing (transform)
import Dict exposing (Dict)
transform : Dict Int (List String) -> Dict String Int
transform input =
let
convertScoreEntry ( score, letters ) =
letters
|> List.map (\l -> ( String.toLower l, score ))
in
Dict.toList input
|> List.concatMap convertScoreEntry
|> Dict.fromList
Other Roc solutions.
module [transform]
transform : Dict U64 (List U8) -> Dict U8 U64
transform = \legacy ->
Dict.walk legacy (Dict.empty {}) \acc, score, letters ->
letters
|> List.map \letter -> (toLower letter, score)
|> Dict.fromList
|> Dict.insertAll acc
toLower = \char -> if char >= 'A' && char <= 'Z' then char + ('a' - 'A') else char