-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Example: main : (Pair (Map U64) U64) = let map = { 1:10 2:20 | 0 } put old_val = new_map@map[1] := 100 #Pair{new_map old_val} Will: 1. set 'map[1]' to '100', assigning the result to the 'new_map' name 2. return the old value as 'old_val' (or the default, '0', if absent) The result is: Pair{{1:100 2:20 | 0} 10} We can also abbreviate it when the new name == the map name: main : (Pair (Map U64) U64) = let map = { 1:10 2:20 | 0 } put old = map[1] := 100 #Pair{map old} And we can omit 'old' when we don't need it: main : (Map U64) = let map = { 1:10 2:20 | 0 } put map[1] := 100 map There is also a 'get' operation, which just retrieves a value: main : U64 = let map = { 1:10 2:20 | 0 } get val = map[1] val
- Loading branch information
1 parent
2692445
commit c8b8b72
Showing
8 changed files
with
516 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.