Skip to content

Instantly share code, notes, and snippets.

@mheiber
Last active April 18, 2021 18:55
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 mheiber/9b26c96d4019b7d50ae1153512096d2e to your computer and use it in GitHub Desktop.
Save mheiber/9b26c96d4019b7d50ae1153512096d2e to your computer and use it in GitHub Desktop.
(* ocaml *)
type tag = X | Y
let make_point x y = function
| X -> x
| Y -> y
let get_x pt = pt X
let get_y pt = pt Y
let pt = make_point 1 2
let () = Printf.printf "%d %d" (get_x pt) (get_y pt)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment