Skip to content

Instantly share code, notes, and snippets.

@bpatra
Last active December 20, 2015 04:58
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 bpatra/6074329 to your computer and use it in GitHub Desktop.
Save bpatra/6074329 to your computer and use it in GitHub Desktop.
Using the mutable tree and its mergeInto function introduced ingist:6074217
let tree = ref Tree.Empty
let branch1 = ["a";"b";"c"]
let branch2 = ["a";"b";"d"]
let branch3 = ["a";"f"]
do mergeInto tree branch1
do mergeInto tree branch2
do mergeInto tree branch3
//the following tree is created
// a
// / \
// f b
// / \
// d c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment