Lists in OCaml are immutable. Therefore, you cannot remove things from them. Usually you create another list that does not have what you do not want. You must use List.filter .
If you absolutely need to have mutable lists, you can. There is something in Batteries called a Dllist that might look like what you want. (This is a double-linked list, however, unlike the Lisp list).
One of the great things about OCaml, in my opinion, is that a purely functional subset is really quite efficient. I have never had to use modified lists in my own projects.
Jeffrey scofield
source share