Created
April 26, 2015 13:45
-
-
Save SteveGilham/8951080739d59359fa35 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
| exception EmptyList of string | |
| let rec folds g x | |
| = match x | |
| with [] -> raise (EmptyList "folds") | |
| | [x] -> x | |
| | h::t -> g h (folds g t) | |
| try folds (fun x y -> x + y) [] | |
| with EmptyList m -> stdout.WriteLine(m); | |
| 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment