Skip to content

Instantly share code, notes, and snippets.

@kunigami
Created August 20, 2017 23:59
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 kunigami/12077df4e370d584202cdb59f9e1456d to your computer and use it in GitHub Desktop.
Save kunigami/12077df4e370d584202cdb59f9e1456d to your computer and use it in GitHub Desktop.
type 'a tree = Leaf of 'a | Node of {
size: int; (* Number of elements/leaves in the tree - not nodes *)
left: 'a tree; (* left sub-tree *)
right: 'a tree; (* right sub-tree *)
};;
(* Binary representation of the list *)
type 'a digit = Zero | One of 'a tree;;
type 'a t = 'a digit list;;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment