select_count bug?

Ulf Wiger (AL/EAB) ulf.wiger@REDACTED
Wed Jan 25 09:51:14 CET 2006


1> T = ets:new(task_table, [set, protected, {keypos, 1}]).
16
2> ets:insert(T, {1, "hi", b}).
true
3> ets:select(T, [{{'_', "hi", '_'},[],['$_']}]).
[{1,"hi",b}]
4> ets:select_count(T, [{{'_', "hi", '_'},[],['$_']}]).
0
5> ets:select_count(T, [{{'_', "hi", '_'},[],[true]}]).
1

You have to modify the select pattern slightly for 
select_count. It takes the same type of match spec as 
select_delete/2 -- not as select/2.

/Uffe 

> -----Original Message-----
> From: owner-erlang-questions@REDACTED 
> [mailto:owner-erlang-questions@REDACTED] On Behalf Of Samuel Rivas
> Sent: den 25 januari 2006 09:45
> To: erlang-questions@REDACTED
> Subject: ets:select_count bug?
> 
> Hi,
> 
> I tried this in R10B-9
> 
> 1> T = ets:new(task_table, [set, protected, {keypos, 1}]).
> 18
> 2> ets:insert(T, {1, "hi", b}).
> true
> 3> ets:select(T, [{{'_', "hi", '_'},[],['$_']}]).
> [{1,"hi",b}]
> 4> ets:select_count(T, [{{'_', "hi", '_'},[],['$_']}]).
> 0
> 
> Is this a select_count bug or am I doing something wrong?
> 
> -- 
> 	Samuel
> 



More information about the erlang-questions mailing list