[erlang-questions] ets:match_delete

Tobias <>
Tue Jun 7 17:43:49 CEST 2011


Hi Roberto,

have you tried

N = ets:select_delete(test, [{{'$1', '$2', '$3', '$4'}, [{'>', '$2', 2}], [true]}]),

instead?

Cheers,
Tobias

On Jun 7, 2011, at 5:33 PM, Roberto Ostinelli wrote:

> 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.
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list