ets:match_spec_run/2

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

ets:match_spec_run/2

Ulf Wiger-4

I found this undocumented functionality in ets:

1> MS = ets:match_spec_compile([{{'_',2},[],['$_']}]).
<<>>
2> ets:match_spec_run([{a,1},{a,2},{b,2}], MS).
[{a,2},{b,2}

It's used e.g. when implementing mnesia:select().

What is the status of these two functions?

(I realise that you can write an erlang equivalent using for
example lists:filter() that's a lot prettier, but the point
(one point) of the function is obviously when you have a
match spec already and need to apply it to a list.)

BTW, what kind of magical empty binary is that?

/Uffe

--
Ulf Wiger, Senior Specialist,
   / / /   Architecture & Design of Carrier-Class Software
  / / /    Strategic Product & System Management
 / / /     Ericsson AB, Connectivity and Control Nodes