The map prototype ($map_proto) defines verbs that perform operations on the receiver, which will be of type MAP. All verbs are of the general form:
any map:verb(...)
Where map may be a map literal or an expression returning a map value.
LIST map:keys()
Returns the keys in map.
[1 -> #1, 2 -> #2, 3 -> #3]:keys() => {1, 2, 3}
LIST map:values()
Returns the values in map.
[1 -> #1, 2 -> #2, 3 -> #3]:values() => {#1, #2, #3}
MAP map:delete(key, ...)
Deletes the specified keys/values from map.
[1 -> #1, 2 -> #2, 3 -> #3]:delete(2, 3) => [1 -> #1]
MAP map:merge(MAP other)
Returns a new map constructed from the elements in map and other. If there are duplicate keys, the keys/values in other replace the keys/values in map.
[1 -> #1, 2 -> #2, 3 -> #3]:merge([0 -> "hello", 1 -> "there"]) => [0 -> "hello", 1 -> "there", 2 -> #2, 3 -> #3]
INT map:is_empty()
Returns true if map contains no elements.
[1 -> 2]:is_empty() => 0
[]:is_empty() => 1
INT map:has_key(key)
Returns true if map contains key key.
[1 -> #1, 2 -> #2, 3 -> #3]:has_key(2) => 1
[1 -> #1, 2 -> #2, 3 -> #3]:has_key(4) => 0
INT map:has_value(value)
Returns true if map contains value value.
[1 -> #1, 2 -> #2, 3 -> #3]:has_value(#2) => 1
[1 -> #1, 2 -> #2, 3 -> #3]:has_value(#4) => 0
MAP map:invert()
Returns a copy of map with the keys and values swapped.
[1 -> #1, 2 -> #2, 3 -> #3]:invert() => [#1 -> 1, #2 -> 2, #3 -> 3]
MAP map:slice(key, ...)
Returns a copy of map with only the keys/values represented by the specified keys included.
[1 -> #1, 2 -> #2, 3 -> #3]:slice(2, 3) => [2 -> #2, 3 -> #3]
LIST map:to_list()
Returns a list of lists constructed from the elements in map, using the key as the first element in the pair and the value as the second.
[1 -> 2, 3 -> 4]:to_list() => {{1, 2}, {3, 4}}