Per creare un elenco a Elm si può fare:Come creare un Dict in Elm per i test?
list = ["test","test2"]
ma come posso creare un Dict a scopo di test?
Ho letto Dict - core 3.0.0.
Per creare un elenco a Elm si può fare:Come creare un Dict in Elm per i test?
list = ["test","test2"]
ma come posso creare un Dict a scopo di test?
Ho letto Dict - core 3.0.0.
let dict = Dict.fromList [("key1", "value1"), ("key2", "value2")]
Per inserire un elemento: let dict' = Dict.insert "key3" "value3" dict
Per cercare un elemento:
case Dict.get "key1" dict of
Just value -> ... -- do something with value
Nothing -> ... -- no such value in dict
'Dict.lookup' sembra essere chiamato' Dict.get' ora. http://package.elm-lang.org/packages/elm-lang/core/latest/Dict –
@NameMcChange Grazie, aggiornato! –
Ancora sto raccomandando di leggere il [complete docs] (http: // olmo-lang .org/docs) prima :) –