roc/builtins/Map.roc

17 lines
571 B
Plaintext
Raw Normal View History

2019-12-04 01:46:12 +03:00
interface Map
2019-12-16 01:19:16 +03:00
exposes [ Map, isEmpty ]
2019-12-04 01:46:12 +03:00
imports []
2019-12-16 01:19:16 +03:00
isEmpty : Map * * -> Bool
## Convert each key and value in the #Map to something new, by calling a conversion
## function on each of them. Then return a new #Map of the converted keys and values.
##
2019-12-21 23:14:11 +03:00
## >>> Map.map {{ 3.14 => "pi", 1.0 => "one" }} \{ key, value } -> { key:
2019-12-16 01:19:16 +03:00
##
2019-12-21 23:14:11 +03:00
## >>> Map.map {[ "", "a", "bc" ]} Str.isEmpty
2019-12-16 01:19:16 +03:00
##
## `map` functions like this are common in Roc, and they all work similarly.
## See for example #Result.map, #List.map, and #Set.map.
map : List before, (before -> after) -> List after