Ocaml implementation of quadtree with functions.