> It can be shorter still, if all you want is insert and read
Despite the name, I'm afraid this is a simple binary tree implementation, not a BTree:
type 'a tree = Empty | Node of('a * 'a tree * 'a tree);;
Obviously the author didn't know what he was doing (the intended scope was very large, AVL, BTrees, etc. but he stopped after committing this single file).
> Here is a Btree implementation from the mirage project
And in fact, this implementation does not show a lot because the actual B-tree work is done by the baardskeerder library: https://github.com/Incubaid/baardskeerder
It looks very large and complex, it is most certainly possible to write a simpler, pedagogical implementation.
Found cpc https://github.com/kerneis/cpc from your comment stream. Looks super interesting. http://felix-lang.org/share/src/web/tut/fibres_index.fdoc might pique your interest. It also compiles coroutines portably and efficiently (to a C++ runtime library). Felix tries to do for C++ what F# does to C# (in case there is any confusion, I am just a new user)
Here is a Btree implementation from the mirage project [1] https://github.com/cgreenhalgh/ocaml-btree/blob/master/lib/b...
EDIT: removed link to binary tree after kerneis pointed it out.
[1] http://www.openmirage.org/