Skip to content

Instantly share code, notes, and snippets.

@Wilfred Wilfred/ Secret
Created Dec 14, 2018

What would you like to do?
type fruit =
| Banana of int
| Apple of int
let fruit_value include_banana f =
match f with
(* Error: The value include_banana is not an instance variable *)
| Banana x when include_banana
| Apple x ->
| _ -> 0
let rec sum_fruit include_banana vals =
List.fold_left (fun x f -> x + fruit_value include_banana f) vals
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.