Skip to content

Instantly share code, notes, and snippets.

@SteveGilham
Created April 26, 2015 13:45
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