-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes documentation, makes tests return simpler values, deletes usele…
…ss snapshot
- Loading branch information
1 parent
8d9a7e0
commit 2903f35
Showing
12 changed files
with
96 additions
and
74 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
# Checks if a generic map contains a given key, and if it does, applies a function to the value, otherwise it returns the map | ||
def test(m: Map(u24), key: u24) -> Map(u24): | ||
def test(m: Map(u24), key: u24) -> u24: | ||
def addtwo (x: u24) -> u24: | ||
return (x + 2) | ||
(num, map) = Map/contains(m, key) | ||
if (num == 0): | ||
return m | ||
return unreachable() | ||
else: | ||
return Map/map(m, key, addtwo()) | ||
|
||
m = Map/map(m, key, addtwo()) | ||
(value, map) = Map/get(m, key) | ||
return value | ||
def main() -> _: | ||
m = {3: 255} | ||
return test(m, 3) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
def test1() -> (u24, Map(u24)): | ||
def test1() -> (u24): | ||
m = {} | ||
m = Map/set(Map/set(Map/set(Map/empty, 3, 4), 2, 3), 1, 2) | ||
(val, map) = Map/get(m, 1) | ||
return Map/get(map, val) | ||
|
||
(val1, map1) = Map/get(m, 1) | ||
(val2, map2) = Map/get(map1, val1) | ||
return val2 | ||
|
||
def main() -> _: | ||
return test1() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#Tests the get_check function | ||
def main() -> _: | ||
m1 = {0: 42, 1: 7, 2: 13, 3: 255, 4: 100} | ||
m1 = {0: 1, 3: 2} | ||
return Map/get_check(m1, 3) | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
def main() -> _: | ||
m1 = {0: 42, 1: 7, 2: 13, 3: 255, 4: 100} | ||
m1 = {0: 23} | ||
return Map/contains(m1, 3) |
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 was deleted.
Oops, something went wrong.
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
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