[erlang-questions] Munging ets continuations

Ulf Wiger ulf.wiger@REDACTED
Mon Sep 7 10:37:43 CEST 2009


Colm Dougan wrote:
> My question is: is there a programmatic way to create continuations 
> for a given offset/length?  Or is there a way I can munge it myself?

I imagine that you would have to be prepared to meditate
regularly on the VM internals in order to maintain this. :)


> 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).

BR,
Ulf W
-- 
Ulf Wiger
CTO, Erlang Training & Consulting Ltd
http://www.erlang-consulting.com


More information about the erlang-questions mailing list