2.5.17. Map

TODO.

2.5.17.1. Instruction

map.clear op1 [map::Clear]
Operator 1:ref<map<*>>

Removes all entries from map op1.

map.default op1 op2 [map::Default]
Operator 1:ref<map<*>>
Operator 2:any

Sets a default value op2 for map op1 to be returned by map.get if a key does not exist.

target = map.exists op1 op2 [map::Exists]
Target:bool
Operator 1:ref<map<*>>
Operator 2:any

Checks whether the key op2 exists in map op1. If so, the instruction returns True, and False otherwise.

target = map.get op1 op2 [map::Get]
Target:any
Operator 1:ref<map<*>>
Operator 2:any

Returns the element with key op2 in map op1. Throws IndexError if the key does not exists and no default has been set via map.default.

target = map.get_default op1 op2 op3 [map::GetDefault]
Target:any
Operator 1:ref<map<*>>
Operator 2:any
Operator 3:any

Returns the element with key op2 in map op1 if it exists. If the key does not exists, returns op3.

map.insert op1 op2 op3 [map::Insert]
Operator 1:ref<map<*>>
Operator 2:any
Operator 3:any

Sets the element at index op2 in map op1 to *op3. If the key already exists, the previous entry is replaced.

map.remove op1 op2 [map::Remove]
Operator 1:ref<map<*>>
Operator 2:any

Removes the key op2 from the map op1. If the key does not exists, the instruction has no effect.

target = map.size op1 [map::Size]
Target:int<64>
Operator 1:ref<map<*>>

Returns the current number of entries in map op1.

map.timeout op1 op2 op3 [map::Timeout]
Operator 1:ref<map<*>>
Operator 2:enum { }
Operator 3:interval

Activates automatic expiration of items for map op1. All subsequently inserted entries will be expired after an interval of op3 after they have been added (if op2 is Expire::Create) or last accessed (if op2 is Expire::Access). Expiration is disable if *op3 is zero. Throws NoTimerManager if no timer manager has been associated with the map at construction.