
29 Jun
2010
29 Jun
'10
7:13 a.m.
Ketil Malde schrieb: [...]
I don't think there would be any doubt what 'deleteBy (<= 5) [1..10]' would do. Well, if you don't know about filter, you could think it deletes all elements satisfying the predicate, but apart from that, it's clear.
I'd probably call it 'filter1', but that's just my personal convention.
I've called it 'deleteFirst' in http://hackage.haskell.org/trac/ghc/ticket/3399 I would expect it to be more efficient than filter (with a negated predicate), because no further comparisons are necessary once the element to be deleted has been found. C.