The reason I mention that:
"There already is an algorithm for deletion available, which Sedgewick [2008] presented alongside his introduction to Left-Leaning Red-Black trees. This algorithm, however, while being pretty concise, follows a very imperative approach, containing a lot of nested if-else-blocks and breaking several invariants during its run by design, later fixing everything up using several auxiliary functions. [...]
Instead, we follow an approach which is closer to what Okasaki [1999] did with his seminal, purely functional implementation of insertion in Red-Black trees. That is, our algorithm relies purely on pattern matching and simple recursive decent. Moreover, of the three functions it consists of, the two which implement the algorithm’s bulk are completely self-contained, i.e. do not rely on auxiliary functions."
The reason I mention that: "There already is an algorithm for deletion available, which Sedgewick [2008] presented alongside his introduction to Left-Leaning Red-Black trees. This algorithm, however, while being pretty concise, follows a very imperative approach, containing a lot of nested if-else-blocks and breaking several invariants during its run by design, later fixing everything up using several auxiliary functions. [...]
Instead, we follow an approach which is closer to what Okasaki [1999] did with his seminal, purely functional implementation of insertion in Red-Black trees. That is, our algorithm relies purely on pattern matching and simple recursive decent. Moreover, of the three functions it consists of, the two which implement the algorithm’s bulk are completely self-contained, i.e. do not rely on auxiliary functions."