3.28. kink/container/MAP

Operations for maps.

3.28.1. MAP.map?(Val)

Returns true if the Val is a map, otherwise false.

3.28.2. type map

A container mapping from keys to vals.

Equivalence of keys is defined by each map implementation.

Map.set(Key Val)

Associates the Key to the Val.

If the Map contains a key equivalent to the Key, it depends on implementation whether the key is replaced by the new Key or not.

Map.get(Key)

Returns the val associated to the Key.

Precondition: the Map must contains a key equivalent to the Key.

Map.get_or(Key $supply_default)

Returns the val associated to the Key, or tail-calls the thunk $supply_default if such a key does not exist.

Map.have_key?(Key)

Returns true if the Map contains a key equivalent to the Key, otherwise returns false.

Map.size

Returns the size of the Map, that is, the number of the key-val entries.

Map.empty?

Returns true the Map contains no entry, otherwise returns false.

Map.nonempty?

Returns true the Map contains one or more entries, otherwise returns false.

Map.op_eq(Another_map)

Returns true if Map and Another_map have the equivalent set of keys, and equal vals corresponding to the keys.

Equivalence of keys must be defined as the same between two maps.

Equality of vals are tested by Val == Another_val.

Map.op_ne(Another_map)

Returns true if Map and Another_map does not have the equivalent set of keys, or does not have equal vals corresponding to the keys.

Equivalence of keys must be defined as the same between two maps.

Equality of vals are tested by Val == Another_val.

Map.pop_at(Key)

Pops the val associated to the Key.

Precondition: the Map must contains a key equivalent to the Key.

Map.clear

Removes all the entries.

Map.set_each_pair(Pair_eacher)

Sets each key-val entries in the Pair_eacher.

Pair_eacher is an eacher, which yields pair lists of [key val].

Map.key_iter

Iter of the keys.

Map.pair_iter

Iter of the pairs of [key val].

3.28.3. MAP.ordered_map?(Val)

Returns true if the Val is an ordered_map, otherwise false.

3.28.4. type ordered_map

A subtype of map which supports ordering of keys.

The ordering is defined by each ordered_set implementation.

Ordered_map.key_iter

Iter of the keys in the ordering of the map.

Ordered_map.pair_iter

Iter of the pairs of [key val] in the ordering of the map.

Ordered_map.front_key

The key which comes first in the ordering of the map.

Ordered_map.back_key

The key which comes last in the ordering of the map.

Ordered_map.key_iter_from(Min_key)

Iter of the keys equivalent to or bigger than the Min_key in the ordering of the map.

Ordered_map.pair_iter_from(Min_key)

Iter of the pairs of [key val], whose keys is equivalent to or bigger than the Min_key in the ordering of the map.