Created
March 28, 2017 20:57
-
-
Save ccorcos/f86678c0e4d2d9ebcc5a7c12046440d4 to your computer and use it in GitHub Desktop.
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
type state = int; | |
type action = | |
| Inc | |
| IncBy int | |
| Dec | |
| DecBy int | |
| Reset; | |
let update state action => | |
switch action { | |
| Inc => state + 1 | |
| IncBy n => state + n | |
| Dec => state - 1 | |
| DecBy n => state - n | |
| Reset => 0 | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment