[erlang-questions] ets:select_count & ets:fun2ms problems

Serge Aleynikov saleyn@REDACTED
Wed Apr 23 12:35:31 CEST 2008


For select_count you need to use a different MatchSpec:

ets:fun2ms(fun({M,N}) when N>3 -> true end).

wenew zhang wrote:
> In the erl shell,i input as below
> *********begin*******************
> Tab=ets:new(client,[set,{keypos,1}]).
> ets:insert(Tab,{1,1}).
> ets:insert(Tab,{2,2}).
> ets:insert(Tab,{5,5}).
> ets:insert(Tab,{3,3}).
> ets:insert(Tab,{4,4}).
>  ets:fun2ms(fun({M,N}) when N>3 ->M,N end).
> ets:select_count(Tab,[{{'$1','$2'},[{'>','$2',1}],['$1','$2']}]).
> *********end*******************
> the last line return 0,
> i want get the count of the ets:Tab when column 2>1,
> if i want get Max column2's record([5,5]),how to do ?
> 
> Best Regards
> 
> Wenew Zhang
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list