[erlang-questions] How to find an object in an ETS table ?

Ariel Gómez <>
Fri Nov 26 18:33:02 CET 2010


This is the right command:

18> ets:match_object(E,{'_',2}).
[{456,2}]

Ariel Gómez

-----Mensaje original-----
De:  [mailto:] En
nombre de info
Enviado el: viernes, 26 de noviembre de 2010 12:32
Para: erlang-questions
Asunto: [erlang-questions] How to find an object in an ETS table ?

Hello,

Probably an error of beginner ...
E=ets:new('my_table',[]),
ets:insert(E,{123,1}),
ets:insert(E,{456,2}),
The following command find the key 123 and return the object 1
ets:lookup(E,123),
The following command returns empty !
R1=ets:match(E,{'_',2,'$1'}),
How to find the object 2 ?

J-Ph. Constantin
ITS3 Genhve
www.its3.ch



More information about the erlang-questions mailing list