[ library(m_map) | Reference Manual | Alphabetic Index ]

set(+Map0, ++Key, ?Value, -Map)

Update the value corresponding to a key in a map, inserting the key if it doesn't exist already.
Map0
A map
Key
A key to set
Value
The value corresponding to Key
Map
The map after setting

Description

If the key Key already exists in the map Map0, then this predicate updates the corresponding value to be Value. Otherwise it inserts the key Key into the map with value Value. The resulting map is Map.

This predicate should only be called with maps created by other predicates from the map module.

Fail Conditions

Never fails.

Resatisfiable

no

See Also

insert / 4, det_insert / 4, update / 4, det_update / 4