Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Quick OCaml tree example

View tree.ml
1 2 3 4 5 6 7 8 9 10 11 12
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
Something went wrong with that request. Please try again.