[erlang-questions] Munging ets continuations

Colm Dougan colm.dougan@REDACTED
Mon Sep 7 16:41:01 CEST 2009


On Mon, Sep 7, 2009 at 9:37 AM, Ulf
Wiger<ulf.wiger@REDACTED> wrote:
> Colm Dougan wrote:
>> My use-case is that I have an ordered_set table with (say) 1000 entries
>> and I want to look at a given offset within them, e.g.
>> entries 700 to 720 without having to pull back the whole list or walk
>> along it in chunks until I reach 700.
>
> Presumably, you don't know the value of the key of entry 700,
> or you would simply pass that to ets:next/2 and iterate from there.
>
> It seems to me that ets:slot/2 is what you need.
> From the manual:
>
> "If the table is of type ordered_set, the function returns a list containing
> the I:th object in Erlang term order."
>
> (It starts with slot 0).

Thanks Ulf.  ets:slot does exactly what I need.

Thanks,
Colm


More information about the erlang-questions mailing list