[erlang-questions] ets:match_delete

Roberto Ostinelli <>
Tue Jun 7 17:33:55 CEST 2011


dear list,

i'm trying to match delete elements from an ETS table which have one of the
tuple elements greater than 2.

start() ->
    ets:new(test, [named_table, set, protected]),
    ets:insert(test, {a, 1, true, true}),
    ets:insert(test, {b, 2, true, true}),
    ets:insert(test, {c, 3, true, true}),
    ets:insert(test, {d, 2, true, true}),
    ets:insert(test, {e, 1, true, true}),
    ets:match_delete(test, [{['_', '$1', '_', '_'], [{'>', '$1', 2}], []}]),
    Result = ets:tab2list(test),
    ets:delete(test),
    Result.

this however does return the whole table.

any hints on what i'm doing wrong?

r.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110607/3fcd2899/attachment.html>


More information about the erlang-questions mailing list