Skip to content

Instantly share code, notes, and snippets.

@Wilfred

Wilfred/fruit.ml Secret

Created January 24, 2019 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Wilfred/b160baa5a2d14dee04103b1e50e3f985 to your computer and use it in GitHub Desktop.
Save Wilfred/b160baa5a2d14dee04103b1e50e3f985 to your computer and use it in GitHub Desktop.
type fruit = Apple of int | Pear of int
;;
(* Returns an int, not a function! *)
let foo =
let y = 2 in begin
function
| Apple x -> x + y
| Pear x -> x + y
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment