-
-
Save Wilfred/ad0978bc894201b21ce823bad60a207a 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 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 -> | |
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