Constant Time ETS Ordered Set Get Largest-Keyed Member ?

Sean Hinde sean.hinde@REDACTED
Fri Oct 24 21:42:21 CEST 2003

On Friday, October 24, 2003, at 07:55  pm, Eric Newhuis wrote:

> O Great ETS Masters,
> Is there a "constant time" ETS ordered set get largest-keyed member 
> function, technique, or trick?
> I want to retreive the last member of the ordered set, the one with 
> the largest valued key, often enough to justify building a separate 
> ETS index table.  My code would be simpler, however, of course, if I 
> could avoid the extra ETS table.
> In C++, with a heavy dose of the Standard C++ Library containers, I'd 
> probably do this with the "reverse end" member of a map<>.
> Sincerely,
> Eric Newhuis

Maybe I'm missing something, but ets:last/1 finds the entry with the 
largest key in an ordered set table. I'm not sure how I'd use an index 
table to do this though so I might be barking up the wrong tree.


More information about the erlang-questions mailing list