Created
October 19, 2009 01:30
-
-
Save Ball/213010 to your computer and use it in GitHub Desktop.
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
type expression = | |
| Empty | |
| Number of int | |
let expression stream = | |
match stream with | |
| [] -> Empty, stream | |
| h::t -> Number( Int32.Parse(h)), t | |
let evaluate expr = | |
match expr with | |
| Empty -> 0 | |
| Number(a) -> a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment