Delete an element from a binary search tree in F#
I'm trying to write a method to delete an element from a BST. So far, this is what I have. I'm not sure if I'm on the right track or if there is a better way to do it by using pattern matching to match the different delete cases ie: no children, 1 child, 2 children. type 'a bst = NL | BinTree of 'a * 'a bst * 'a bst;; let rec smallest = function | NL -> failwith "tree is empty" | BinTree(m, lst, rst) -> if lst = NL then BinTree(m, lst, rst) else smallest lst;; let rec smallest2 = function | NL -> failwith "tree is empty" | BinTree(m, lst, rst) -> if lst = NL then m else smallest2 lst;; let rec