[Solved] OCaml: How can I return the first element of a list and after that remove it from the list?
I think there are a couple of misunderstandings here. First, most types in OCaml are immutable. Unless you use mutable variables you can’t “remove it from the list”, you can only return a version of the list that doesn’t have that first item. If you want to return both things you can achieve that using … Read more