![]() |
| ||||||
Navigation |
Synopsis Union of two maps.
Syntax
Exp1 + Exp2
Types
Description The result is the union of the two map values of
Exp1 and Exp2 .
If they have a pair with the same key in common, that key will be associated
in the union with the value associated with that key in Exp2 .
Examples
rascal>("apple": 1, "pear": 2) + ("banana": 3, "kiwi": 4); map[str, int]: ("banana":3,"pear":2,"kiwi":4,"apple":1) rascal>("apple": 1, "pear": 2) + ("banana": 3, "apple": 4); map[str, int]: ("banana":3,"pear":2,"apple":4)
Benefits Map union is very suited for representing environment composition in interpreters.
![]() |