Created
January 16, 2019 07:56
-
-
Save paulvictor/e01275e5927bcf632c6b4d320b0e8c7c to your computer and use it in GitHub Desktop.
Translating from python to purs
This file contains hidden or 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
| def func(): | |
| i = 0; | |
| j = 0; | |
| for (x in xs) | |
| i = i+1; | |
| if (x.foo == "bar") | |
| j += 1; | |
| else | |
| j += 0; | |
| // At this point, i and j are the variables we are interested in |
This file contains hidden or 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
| func = execState | |
| (for_ xs \x -> do | |
| modify_ ({i, j} -> {i: i + 1; j}) | |
| modify_ ({i, j} -> {i: i, j: if x.foo == "bar" then j + 1 else j + 0})) {i: 0, j: 0} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment