Create a gist now

Instantly share code, notes, and snippets.

Quick OCaml tree example
type tree = Node of tree * int * tree | Nil
open Printf
let rec print_tree t =
match t with
| Node (left, data, right) -> print_tree left;
printf "%d\n" data;
print_tree right
| Nil -> ();;
print_tree (Node (Node (Nil, 1, Nil), 3, Node (Nil, 2, Nil)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment