map¶
fun map::by(Sequence: any, Fn₁, : function, ...): mapReturns a map with keys
Fnₙ(...(Fn₁(Vᵢ)))and valuesVᵢwhereVᵢare the values produced bySequence.map::by("ABCDEFGH", :code) :> {65 is "A", 66 is "B", 67 is "C", 68 is "D", 69 is "E", 70 is "F", 71 is "G", 72 is "H"}
fun map::to(Sequence: any, Fn₁, : function, ...): mapReturns a map with keys
Vᵢand valuesFnₙ(...(Fn₁(Vᵢ)))whereVᵢare the values produced bySequence.map::to("ABCDEFGH", :code) :> {"A" is 65, "B" is 66, "C" is 67, "D" is 68, "E" is 69, "F" is 70, "G" is 71, "H" is 72}
meth (Key: any):in(Map: map): any | nilReturns
Keyif it is inMap, otherwise returnnil.let M := {"A" is 1, "B" is 2, "C" is 3} "A" in M :> "A" "D" in M :> nil
type map < sequenceA map of key-value pairs. Keys can be of any type supporting hashing and comparison. By default, iterating over a map generates the key-value pairs in the order they were inserted, however this ordering can be changed.
meth map(Key₁ is Value₁, ...): mapReturns a new map with the specified keys and values.
map(A is 1, B is 2, C is 3) :> {"A" is 1, "B" is 2, "C" is 3}
meth map(Sequence: sequence, ...): mapReturns a map of all the key and value pairs produced by
Sequence.map("cake") :> {1 is "c", 2 is "a", 3 is "k", 4 is "e"}
meth map(): mapReturns a new map.
map() :> {}
fun map::join(Map₁, : map, ..., Fn: function): mapReturns a new map containing the union of the keys of
Mapᵢ, and with valuesFn(V₁, ..., Vₙ)where eachVᵢcomes fromMapᵢ(ornil).let A := map(swap("apple")) :> {"a" is 1, "p" is 3, "l" is 4, "e" is 5} let B := map(swap("banana")) :> {"b" is 1, "a" is 6, "n" is 5} let C := map(swap("pear")) :> {"p" is 1, "e" is 2, "a" is 3, "r" is 4} map::join(A, B, C, tuple) :> {"a" is (1, 6, 3), "p" is (3, nil, 1), "l" is (4, nil, nil), "e" is (5, nil, 2), "b" is (nil, 1, nil), "n" is (nil, 5, nil), "r" is (nil, nil, 4)}
fun map::join2(Map₁, : map, ..., Fn: function): mapReturns a new map containing the union of the keys of
Mapᵢ, and with valuesFn(K, V₁, ..., Vₙ)where eachVᵢcomes fromMapᵢ(ornil).let A := map(swap("apple")) :> {"a" is 1, "p" is 3, "l" is 4, "e" is 5} let B := map(swap("banana")) :> {"b" is 1, "a" is 6, "n" is 5} let C := map(swap("pear")) :> {"p" is 1, "e" is 2, "a" is 3, "r" is 4} map::join2(A, B, C, tuple) :> {"a" is (a, 1, 6, 3), "p" is (p, 3, nil, 1), "l" is (l, 4, nil, nil), "e" is (e, 5, nil, 2), "b" is (b, nil, 1, nil), "n" is (n, nil, 5, nil), "r" is (r, nil, nil, 4)}
meth (Map: map) :: (Key: string): map::nodeSame as
Map[Key]. This method allows maps to be used as modules.let M := copy({"A" is 1, "B" is 2, "C" is 3}, :const) M::A :> 1 M::D :> nil
meth (Map₁: map) * (Map₂: map): mapReturns a new map containing the entries of
Map₁which are also inMap₂. The values are chosen fromMap₂.let A := map(swap("banana")) :> {"b" is 1, "a" is 6, "n" is 5} let B := map(swap("bread")) :> {"b" is 1, "r" is 2, "e" is 3, "a" is 4, "d" is 5} A * B :> {"b" is 1, "a" is 4}
meth (Map: map) * (Set: set): mapReturns a new map containing the entries of
Mapwhose keys are also inSet.let A := map(swap("banana")) :> {"b" is 1, "a" is 6, "n" is 5} let B := set("bread") :> {b, r, e, a, d} A * B :> {"b" is 1, "a" is 6}
meth (Map₁: map) + (Map₂: map): mapReturns a new map combining the entries of
Map₁andMap₂. If the same key is in bothMap₁andMap₂then the corresponding value fromMap₂is chosen.let A := map(swap("banana")) :> {"b" is 1, "a" is 6, "n" is 5} let B := map(swap("bread")) :> {"b" is 1, "r" is 2, "e" is 3, "a" is 4, "d" is 5} A + B :> {"b" is 1, "a" is 4, "n" is 5, "r" is 2, "e" is 3, "d" is 5}
meth (Map₁: map) / (Map₂: map): mapReturns a new map containing the entries of
Map₁which are not inMap₂.let A := map(swap("banana")) :> {"b" is 1, "a" is 6, "n" is 5} let B := map(swap("bread")) :> {"b" is 1, "r" is 2, "e" is 3, "a" is 4, "d" is 5} A / B :> {"n" is 5}
meth (Map: map) / (Set: set): mapReturns a new map containing the entries of
Mapwhose keys are not inSet.let A := map(swap("banana")) :> {"b" is 1, "a" is 6, "n" is 5} let B := set("bread") :> {b, r, e, a, d} A / B :> {"n" is 5}
meth (Map₁: map) /\ (Map₂: map): mapReturns a new map containing the entries of
Map₁which are also inMap₂. The values are chosen fromMap₂.let A := map(swap("banana")) :> {"b" is 1, "a" is 6, "n" is 5} let B := map(swap("bread")) :> {"b" is 1, "r" is 2, "e" is 3, "a" is 4, "d" is 5} A /\ B :> {"b" is 1, "a" is 4}
meth (Map: map) /\ (Set: set): mapReturns a new map containing the entries of
Mapwhose keys are also inSet.let A := map(swap("banana")) :> {"b" is 1, "a" is 6, "n" is 5} let B := set("bread") :> {b, r, e, a, d} A /\ B :> {"b" is 1, "a" is 6}
meth (Map₁: map) <=> (Map₂: map): mapReturns a tuple of
(Map₁ / Map₂, Map₁ * Map₂, Map₂ / Map₁).let A := map(swap("banana")) :> {"b" is 1, "a" is 6, "n" is 5} let B := map(swap("bread")) :> {"b" is 1, "r" is 2, "e" is 3, "a" is 4, "d" is 5} A <=> B :> ({n is 5}, {b is 1, a is 6}, {r is 2, e is 3, d is 5})
meth (Map₁: map) >< (Map₂: map): mapReturns a new map containing the entries of
Map₁andMap₂that are not in both.let A := map(swap("banana")) :> {"b" is 1, "a" is 6, "n" is 5} let B := map(swap("bread")) :> {"b" is 1, "r" is 2, "e" is 3, "a" is 4, "d" is 5} A >< B :> {"n" is 5, "r" is 2, "e" is 3, "d" is 5}
meth (Map: map)[Key: any]: any | nilReturns the value corresponding to
KeyinMap, ornilifKeyis not inMap.let M := copy({"A" is 1, "B" is 2, "C" is 3}, :const) M["A"] :> 1 M["D"] :> nil
meth (Map₁: map) \/ (Map₂: map): mapReturns a new map combining the entries of
Map₁andMap₂. If the same key is in bothMap₁andMap₂then the corresponding value fromMap₂is chosen.let A := map(swap("banana")) :> {"b" is 1, "a" is 6, "n" is 5} let B := map(swap("bread")) :> {"b" is 1, "r" is 2, "e" is 3, "a" is 4, "d" is 5} A \/ B :> {"b" is 1, "a" is 4, "n" is 5, "r" is 2, "e" is 3, "d" is 5}
meth (Map: map):backwards: SequenceReturns a sequence which will iterate over
Mapbackwards.map(map("abc"):backwards) :> {3 is "c", 2 is "b", 1 is "a"}
meth (Map: map):count: integerReturns the number of entries in
Map.{"A" is 1, "B" is 2, "C" is 3}:count :> 3
meth (Map: map):firstReturns the first value in
MapornilifMapis empty.meth (Map: map):first2Returns the first key and value in
MapornilifMapis empty.meth (Map: map):from(Key: any): sequence | nilReturns the subset of
MapafterKeyas a sequence.let M := {"A" is 1, "B" is 2, "C" is 3, "D" is 4, "E" is 5} map(M:from("C")) :> {"C" is 3, "D" is 4, "E" is 5} map(M:from("F")) :> {}
meth (Map: map):lastReturns the last value in
MapornilifMapis empty.meth (Map: map):last2Returns the last key and value in
MapornilifMapis empty.meth (Map: map):order: map::orderReturns the current ordering of
Map.meth (Map: map):precount: integerReturns the number of entries in
Map.{"A" is 1, "B" is 2, "C" is 3}:count :> 3
meth (List: map):random: anyReturns a random (assignable) node from
Map.let M := map("cake") :> {1 is "c", 2 is "a", 3 is "k", 4 is "e"} M:random :> "e" M:random :> "k"
meth (Map: map):size: integerReturns the number of entries in
Map.{"A" is 1, "B" is 2, "C" is 3}:size :> 3
meth (Buffer: string::buffer):append(Map: map)Appends a representation of
MaptoBuffer.meth (Buffer: string::buffer):append(Map: map, Sep: string, Conn: string)Appends the entries of
MaptoBufferwithConnbetween keys and values andSepbetween entries.type map::labeller < function, mapA labeller is a function which returns an incrementing integer for each new unique argument, but returns the previous integer for previously seen arguments.
let Labels := map::labeller() :> {} Labels("A") :> 1 Labels("B") :> 2 Labels("C") :> 3 Labels("B") :> 2
fun map::labeller(): map::labellerTBD
type map::mutable < mapTBD
meth (Map: map::mutable) :: (Key: string): map::nodeSame as
Map[Key]. This method allows maps to be used as modules.let M := {"A" is 1, "B" is 2, "C" is 3} M::A :> 1 M::D :> nil M::A := 10 :> 10 M::D := 20 :> 20 M :> {"A" is 10, "B" is 2, "C" is 3, "D" is 20}
meth (Map: map::mutable)[Key: any]: map::nodeReturns the node corresponding to
KeyinMap. IfKeyis not inMapthen a new floating node is returned with valuenil. This node will insertKeyintoMapif assigned.let M := {"A" is 1, "B" is 2, "C" is 3} M["A"] :> 1 M["D"] :> nil M["A"] := 10 :> 10 M["D"] := 20 :> 20 M :> {"A" is 10, "B" is 2, "C" is 3, "D" is 20}
meth (Map: map::mutable)[Key: any, Fn: function]: map::nodeReturns the node corresponding to
KeyinMap. IfKeyis not inMapthenFn(Key)is called and the result inserted intoMap.let M := {"A" is 1, "B" is 2, "C" is 3} M["A", fun(Key) Key:code] :> 1 M["D", fun(Key) Key:code] :> 68 M :> {"A" is 1, "B" is 2, "C" is 3, "D" is 68}
meth (Map: map::mutable):delete(Key: any): any | nilRemoves
KeyfromMapand returns the corresponding value if any, otherwisenil.let M := {"A" is 1, "B" is 2, "C" is 3} M:delete("A") :> 1 M:delete("D") :> nil M :> {"B" is 2, "C" is 3}
meth (Map: map::mutable):empty: mapDeletes all keys and values from
Mapand returns it.let M := {"A" is 1, "B" is 2, "C" is 3} :> {"A" is 1, "B" is 2, "C" is 3} M:empty :> {}
meth (Map: map::mutable):exists(Key: any, Fn: function): any | nilIf
Keyis present inMapthen returns the corresponding value. Otherwise insertsKeyintoMapwith valueFn(Key)and returnsnil.let M := {"A" is 1, "B" is 2, "C" is 3} M:exists("A", fun(Key) Key:code) :> 1 M:exists("D", fun(Key) Key:code) :> nil M :> {"A" is 1, "B" is 2, "C" is 3, "D" is 68}
meth (Map: map::mutable):filter(Filter: function): mapRemoves every
ValuefromMapfor whichFunction(Value)returnsniland returns those values in a new map.let M := map(swap("abcdefghij")) M:filter(2 | _) :> {"a" is 1, "c" is 3, "e" is 5, "g" is 7, "i" is 9} M :> {"b" is 2, "d" is 4, "f" is 6, "h" is 8, "j" is 10}
meth (Map: map::mutable):filter2(Filter: function): mapRemoves every
ValuefromMapfor whichFunction(Value)returnsniland returns those values in a new map.let M := map(swap("abcdefghij")) M:filter2(fun(K, V) K = "c" or V = 7) :> {"a" is 1, "b" is 2, "d" is 4, "e" is 5, "f" is 6, "h" is 8, "i" is 9, "j" is 10} M :> {"c" is 3, "g" is 7}
meth (Arg₁: map::mutable):grow(Arg₂₁ is Value₁, ...)Deprecated since version 2.15.0: Use
:insertinstead.meth (Map: map::mutable):grow(Sequence: sequence, ...): mapAdds of all the key and value pairs produced by
SequencetoMapand returnsMap.map("cake"):grow("banana") :> {1 is "b", 2 is "a", 3 is "n", 4 is "a", 5 is "n", 6 is "a"}
meth (Map: map::mutable):insert(Key: any, Value: any): any | nilInserts
KeyintoMapwith corresponding valueValue. Returns the previous value associated withKeyif any, otherwisenil.let M := {"A" is 1, "B" is 2, "C" is 3} M:insert("A", 10) :> 1 M:insert("D", 20) :> nil M :> {"A" is 10, "B" is 2, "C" is 3, "D" is 20}
meth (Map: map::mutable):insert(Key₁ is Value₁, ...): MapInserts the pairs
Keyᵢ, ValueᵢintoMap. ReturnsMap.let M := {"A" is 1, "B" is 2, "C" is 3} M:insert(A is 10, D is 20) :> {"A" is 10, "B" is 2, "C" is 3, "D" is 20}
meth (Map: map::mutable):missing(Key: any): some | nilIf
Keyis present inMapthen returnsnil. Otherwise insertsKeyintoMapwith valuesomeand returnssome.let M := {"A" is 1, "B" is 2, "C" is 3} M:missing("A") :> nil M:missing("D") :> some M :> {"A" is 1, "B" is 2, "C" is 3, "D"}
meth (Map: map::mutable):missing(Key: any, Fn: function): any | nilIf
Keyis present inMapthen returnsnil. Otherwise insertsKeyintoMapwith valueFn(Key)and returns the new value.let M := {"A" is 1, "B" is 2, "C" is 3} M:missing("A", fun(Key) Key:code) :> nil M:missing("D", fun(Key) Key:code) :> 68 M :> {"A" is 1, "B" is 2, "C" is 3, "D" is 68}
meth (Map: map::mutable):order(Order: map::order): mapSets the ordering
meth (Map: map::mutable):pop: any | nilDeletes the first key-value pair from
Mapaccording to its iteration order. Returns the deleted value, ornilifMapis empty.:> Insertion order (default) let M1 := map("cake") :> {1 is "c", 2 is "a", 3 is "k", 4 is "e"} M1:pop :> "c" M1 :> {2 is "a", 3 is "k", 4 is "e"} :> LRU order let M2 := map("cake"):order(map::order::LRU) :> {1 is "c", 2 is "a", 3 is "k", 4 is "e"} M2[2]; M2[4]; M2[1]; M2[3] M2:pop :> "a" M2 :> {4 is "e", 1 is "c", 3 is "k"} :> MRU order let M3 := map("cake"):order(map::order::MRU) :> {1 is "c", 2 is "a", 3 is "k", 4 is "e"} M3[2]; M3[4]; M3[1]; M3[3] M3:pop :> "k" M3 :> {1 is "c", 4 is "e", 2 is "a"}
meth (Map: map::mutable):pop2: tuple[any, any] | nilDeletes the first key-value pair from
Mapaccording to its iteration order. Returns the deleted key-value pair, ornilifMapis empty.:> Insertion order (default) let M1 := map("cake") :> {1 is "c", 2 is "a", 3 is "k", 4 is "e"} M1:pop2 :> (1, c) M1 :> {2 is "a", 3 is "k", 4 is "e"} :> LRU order let M2 := map("cake"):order(map::order::LRU) :> {1 is "c", 2 is "a", 3 is "k", 4 is "e"} M2[2]; M2[4]; M2[1]; M2[3] M2:pop2 :> (2, a) M2 :> {4 is "e", 1 is "c", 3 is "k"} :> MRU order let M3 := map("cake"):order(map::order::MRU) :> {1 is "c", 2 is "a", 3 is "k", 4 is "e"} M3[2]; M3[4]; M3[1]; M3[3] M3:pop2 :> (3, k) M3 :> {1 is "c", 4 is "e", 2 is "a"}
meth (Map: map::mutable):pull: any | nilDeletes the last key-value pair from
Mapaccording to its iteration order. Returns the deleted value, ornilifMapis empty.:> Insertion order (default) let M1 := map("cake") :> {1 is "c", 2 is "a", 3 is "k", 4 is "e"} M1:pull :> "e" M1 :> {1 is "c", 2 is "a", 3 is "k"} :> LRU order let M2 := map("cake"):order(map::order::LRU) :> {1 is "c", 2 is "a", 3 is "k", 4 is "e"} M2[2]; M2[4]; M2[1]; M2[3] M2:pull :> "k" M2 :> {2 is "a", 4 is "e", 1 is "c"} :> MRU order let M3 := map("cake"):order(map::order::MRU) :> {1 is "c", 2 is "a", 3 is "k", 4 is "e"} M3[2]; M3[4]; M3[1]; M3[3] M3:pull :> "a" M3 :> {3 is "k", 1 is "c", 4 is "e"}
meth (Map: map::mutable):pull2: tuple[any, any] | nilDeletes the last key-value pair from
Mapaccording to its iteration order. Returns the deleted key-value pair, ornilifMapis empty.:> Insertion order (default) let M1 := map("cake") :> {1 is "c", 2 is "a", 3 is "k", 4 is "e"} M1:pull2 :> (4, e) M1 :> {1 is "c", 2 is "a", 3 is "k"} :> LRU order let M2 := map("cake"):order(map::order::LRU) :> {1 is "c", 2 is "a", 3 is "k", 4 is "e"} M2[2]; M2[4]; M2[1]; M2[3] M2:pull2 :> (3, k) M2 :> {2 is "a", 4 is "e", 1 is "c"} :> MRU order let M3 := map("cake"):order(map::order::MRU) :> {1 is "c", 2 is "a", 3 is "k", 4 is "e"} M3[2]; M3[4]; M3[1]; M3[3] M3:pull2 :> (2, a) M3 :> {3 is "k", 1 is "c", 4 is "e"}
meth (Map: map::mutable):push(Key: any, Value: any): mapInserts
KeyintoMapwith corresponding valueValue.let M := {"B" is 2, "C" is 3, "A" is 1}:order(map::order::Descending) M:push("A", 10) :> {"A" is 10, "B" is 2, "C" is 3} M:push("D", 20) :> {"D" is 20, "A" is 10, "B" is 2, "C" is 3} M :> {"D" is 20, "A" is 10, "B" is 2, "C" is 3}
meth (Map: map::mutable):put(Key: any, Value: any): mapInserts
KeyintoMapwith corresponding valueValue.let M := {"B" is 2, "C" is 3, "A" is 1}:order(map::order::Descending) M:put("A", 10) :> {"B" is 2, "C" is 3, "A" is 10} M:put("D", 20) :> {"B" is 2, "C" is 3, "A" is 10, "D" is 20} M :> {"B" is 2, "C" is 3, "A" is 10, "D" is 20}
meth (Map: map::mutable):remove(Filter: function): mapRemoves every
ValuefromMapfor whichFunction(Value)doesn't returnniland returns those values in a new map.let M := map(swap("abcdefghij")) M:remove(2 | _) :> {"b" is 2, "d" is 4, "f" is 6, "h" is 8, "j" is 10} M :> {"a" is 1, "c" is 3, "e" is 5, "g" is 7, "i" is 9}
meth (Map: map::mutable):remove2(Filter: function): mapRemoves every
ValuefromMapfor whichFunction(Value)doesn't returnniland returns those values in a new map.let M := map(swap("abcdefghij")) M:remove2(fun(K, V) K = "c" or V = 7) :> {"c" is 3, "g" is 7} M :> {"a" is 1, "b" is 2, "d" is 4, "e" is 5, "f" is 6, "h" is 8, "i" is 9, "j" is 10}
meth (Map: map::mutable):reverse: mapReverses the iteration order of
Mapin-place and returns it.let M := map("cake") :> {1 is "c", 2 is "a", 3 is "k", 4 is "e"} M:reverse :> {4 is "e", 3 is "k", 2 is "a", 1 is "c"}
meth (Map: map::mutable):sort: MapSorts the entries (changes the iteration order) of
MapusingKeyᵢ < Keyⱼand returnsMap.let M := map(swap("cake")) :> {"c" is 1, "a" is 2, "k" is 3, "e" is 4} M:sort :> {"a" is 2, "c" is 1, "e" is 4, "k" is 3}
meth (Map: map::mutable):sort(Cmp: function): MapSorts the entries (changes the iteration order) of
MapusingCmp(Keyᵢ, Keyⱼ)and returnsMaplet M := map(swap("cake")) :> {"c" is 1, "a" is 2, "k" is 3, "e" is 4} M:sort(>) :> {"k" is 3, "e" is 4, "c" is 1, "a" is 2}
meth (Map: map::mutable):sort(Cmp: method): MapSorts the entries (changes the iteration order) of
MapusingCmp(Keyᵢ, Keyⱼ)and returnsMaplet M := map(swap("cake")) :> {"c" is 1, "a" is 2, "k" is 3, "e" is 4} M:sort(>) :> {"k" is 3, "e" is 4, "c" is 1, "a" is 2}
meth (Map: map::mutable):sort2(Cmp: function): MapSorts the entries (changes the iteration order) of
MapusingCmp(Keyᵢ, Keyⱼ, Valueᵢ, Valueⱼ)and returnsMaplet M := map(swap("cake")) :> {"c" is 1, "a" is 2, "k" is 3, "e" is 4} M:sort(fun(K1, K2, V1, V2) V1 < V2) :> {"e" is 4, "k" is 3, "a" is 2, "c" is 1}
meth (Map: map::mutable):splice: mapRemoves every key-value pair from
Map, returns the removed pairs as a new map.meth (Map: map::mutable):splice(Key: any): map | nilRemoves every key-value pair from
Mapstarting atKey, returning the removed pairs as a new map. ReturnsnilifKeyis not inMap.let M := {"A" is 1, "B" is 2, "C" is 3, "D" is 4, "E" is 5, "F" is 6} M:splice("D") :> {"D" is 4, "E" is 5, "F" is 6} M :> {"A" is 1, "B" is 2, "C" is 3}
meth (Map: map::mutable):splice(Key: any, Count: integer): map | nilRemoves
Countkey-value pairs fromMapstarting atKey, returning the removed pairs as a new map. ReturnsnilifKeyis not inMapor there are not enough pairs to remove.let M := {"A" is 1, "B" is 2, "C" is 3, "D" is 4, "E" is 5, "F" is 6} M:splice("C", 2) :> {"C" is 3, "D" is 4} M :> {"A" is 1, "B" is 2, "E" is 5, "F" is 6} M:splice("E", 10) :> nil M :> {"A" is 1, "B" is 2, "E" is 5, "F" is 6}
meth (Map: map::mutable):splice(Count: any, Key: integer, New: map::mutable): mapRemoves
Countkey-value pairs fromMapstarting atKey, then moves the key-value pairs fromNewintoMapleavingNewempty. Returns the removed pairs as a new map, or :nil ifKeyis not inMap.let M := {"A" is 1, "B" is 2, "C" is 3, "D" is 4, "E" is 5, "F" is 6} M:splice("D", 2, {"G" is 7, "H" is 8}) :> {"D" is 4, "E" is 5} M :> {"A" is 1, "B" is 2, "C" is 3, "G" is 7, "H" is 8, "F" is 6}
meth (Map: map::mutable):splice(Key: any, New: map::mutable): mapRemoves every key-value pair from
Mapstarting atKey, then moves the key-value pairs fromNewintoMapleavingNewempty. Returns the removed pairs as a new map, or :nil ifKeyis not inMap.let M := {"A" is 1, "B" is 2, "C" is 3, "D" is 4, "E" is 5, "F" is 6} M:splice("D", {"G" is 7, "H" is 8}) :> {} M :> {"A" is 1, "B" is 2, "C" is 3, "G" is 7, "H" is 8, "D" is 4, "E" is 5, "F" is 6}
meth (Map: map::mutable):take(Source: map::mutable): mapInserts the key-value pairs from
SourceintoMap, leavingSourceempty.let A := map(swap("cat")) :> {"c" is 1, "a" is 2, "t" is 3} let B := map(swap("cake")) :> {"c" is 1, "a" is 2, "k" is 3, "e" is 4} A:take(B) :> {"c" is 1, "a" is 2, "t" is 3, "k" is 3, "e" is 4} A :> {"c" is 1, "a" is 2, "t" is 3, "k" is 3, "e" is 4} B :> {}
type map::nodeA node in a
map. Dereferencing amap::node::constreturns the corresponding value from themap.type map::node::mutable < map::nodeA node in a
map. Dereferencing amap::nodereturns the corresponding value from themap. Assigning to amap::nodeupdates the corresponding value in themap.type map::node::mutableA node in a
map. Dereferencing amap::nodereturns the corresponding value from themap. Assigning to amap::nodeupdates the corresponding value in themap.type map::order < enum::Insert- default ordering; inserted pairs are put at end, no reordering on access.::LRU- inserted pairs are put at start, accessed pairs are moved to start.::MRU- inserted pairs are put at end, accessed pairs are moved to end.::Ascending- inserted pairs are kept in ascending key order, no reordering on access.::Descending- inserted pairs are kept in descending key order, no reordering on access.
fun map::reduce(Sequence: sequence, Reduce: function)Creates a new map,
Map, then appliesMap[Key] := Reduce(old, Value)for eachKey,Valuepair generated bySequence, finally returningMap.map::reduce(swap("banana"); L := [], I) L:put(I) :> {"b" is [1], "a" is [2, 4, 6], "n" is [3, 5]}
meth (Set: set) * (Map: map): mapReturns a new map containing the entries of
Mapwhose keys are also inSet.let A := set("bread") :> {b, r, e, a, d} let B := map(swap("banana")) :> {"b" is 1, "a" is 6, "n" is 5} A * B :> {"b" is 1, "a" is 6}
meth (Set: set) /\ (Map: map): mapReturns a new map containing the entries of
Mapwhose keys are also inSet.let A := set("bread") :> {b, r, e, a, d} let B := map(swap("banana")) :> {"b" is 1, "a" is 6, "n" is 5} A /\ B :> {"b" is 1, "a" is 6}
meth (Copy: visitor):const(Map: map): map::constReturns a new constant map containing copies of the keys and values of
Mapcreated usingCopy.meth (Copy: visitor):copy(Map: map): mapReturns a new map contains copies of the keys and values of
Mapcreated usingCopy.meth (Copy: visitor):visit(Map: map): mapReturns a new map contains copies of the keys and values of
Mapcreated usingCopy.