Quantcast
Channel: Active questions tagged ocaml - Stack Overflow
Viewing all articles
Browse latest Browse all 528

How to delete all occurrences of an item in a list?

$
0
0

So...I have a few problems with that,my goal is to delete items from a list as follows.

For example,I have a list like that:

let list = [1;2;4;5;1;1;6]

And when i do some like this:

remove_from_list 1 list

I want this list back (delete all 1):

[2;4;5;6]

Therefore, I would have a type: 'a ->' a list ->'a list function,if I'm not mistaken...How can I do this with List.filter from Module List? (I've managed to do it without applying .filter but I can't do it this way)


Viewing all articles
Browse latest Browse all 528

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>