In common lisp, we can use the remove
function.
It seems there is no such a method in OCaml ?
Lists in OCaml are immutable. So you can't remove things from them. You normally create another list that doesn't have the things you don't want. For this, you would use List.filter
.
If you absolutely have to have mutable lists, you can. In Batteries there is something called a Dllist that might be like what you want. (It is a doubly linked list, however, unlike a Lisp list).
One of the great things about OCaml, in my opinion, is that the pure functional subset is really quite effective. I've never needed to use mutable lists in my own projects.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With