[erlang-questions] Deleting from a duplicate_bag ets table

Bernard Duggan <>
Fri Feb 6 00:36:28 CET 2009


Bernard Duggan wrote:
> ...If I have an ets table of type duplicate_bag, and I put
> two of the same item in it, how do I delete just one of them?
>   
Since no answers have been forthcoming, I'm going to assume that there
is no one-step way to do this at present.  In which case...
> ...might I suggest adding a ets:select_delete/3, in the same
> style as ets:select/3?
The function I'm envisaging is essentially:

ets:select_delete(Tab, MatchSpec, Limit) -> NumDeleted

which behaves identically to ets:select_delete/2, but deletes a maximum
of Limit items.  I guess an analogous function should probably be added
for dets as well.

Cheers,

Bernard



More information about the erlang-questions mailing list