سؤال

I have a list of record where I want to delete a specific record :

list_clients = [{name = "c6"; number = 9}; {name = "c12"; number = 3}; {name = "c17"; number = 6};]

I'm quite sure that it is impossible to remove a record from the list, but I would like to know what is the best way to return a list without a specific record (let's say that I want to remove name = "c12" or any other name).

هل كانت مفيدة؟

المحلول

List.filter (fun {name; _} -> name <> "c12") list_clients
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top