Logo

Programming-Idioms

History of Idiom 135 > diff from v42 to v43

Edit summary for version 43 by programming-idioms.org:
[Haskell] Variables items, x

Version 42

2020-09-30, 09:15:25

Version 43

2020-09-30, 09:16:48

Idiom #135 Remove item from list, by its value

Remove at most 1 item from list items, having value x.
This will alter the original list or return a new list, depending on which is more idiomatic.
If there are several occurrences of x in items, remove only one of them. If x is absent, keep items unchanged.

Idiom #135 Remove item from list, by its value

Remove at most 1 item from list items, having value x.
This will alter the original list or return a new list, depending on which is more idiomatic.
If there are several occurrences of x in items, remove only one of them. If x is absent, keep items unchanged.

Variables
items,x
Variables
items,x
Imports
import Data.List
Imports
import Data.List
Code
delete
Code
delete x items
Comments bubble
base contains a function that does this.
Comments bubble
base contains a function that does this.
Doc URL
http://hackage.haskell.org/package/base/docs/Data-List.html#v:delete
Doc URL
https://hackage.haskell.org/package/base-4.14.0.0/docs/Data-List.html#v:delete