[erlang-questions] ets:match_delete

Anthony Ramine nox@REDACTED
Tue Jun 7 19:26:15 CEST 2011


Le 7 juin 2011 à 19:15, Roberto Ostinelli a écrit :

> 2011/6/7 Anthony Ramine <nox@REDACTED>
> 
> [{{'_','$1','_','_'},[{'>','$1',2}],[]}] should work. You put a list instead of a tuple for the match argument.
> By the way I didn't read the doc to figure it out, I just did ets:fun2ms(fun ({_,X,_,_}) when X > 2 -> X end),
> which is pretty good for figuring out how to write matchspecs.
> 
> hi anthony,
> 
> no this does not work.
> 
> furthermore, i took the list format from the 2nd example provided in the docs:
> http://www.erlang.org/doc/apps/erts/match_spec.html#id71596
> 
> thank you anyway :)
> 
> r.

My bad then, ets:match_delete must behave differently than lookup then, because this works:

	ets:test_ms({a, 3, b, c}, [{{'_', '$1', '_', '_'},[{'>', '$1', 2}],['it works!']}])

--
Anthony Ramine
Dev:Extend
http://dev-extend.eu







More information about the erlang-questions mailing list