<div dir="ltr">Hi,<br>I want to retrieve N tuple with an offset O from the end of a table. N and O are integer(). I consider that the acces is based on an ordered table.<br><br>Here is an example, I have such tuples in my table t :<br>
[{t, 1, _},<br>{t, 2, _},<br>{t, 3, _},<br>{t, 4, _},<br>{t, 5, _},<br>{t, 6, _},<br>{t, 7, _}]<br><br>For N=2 and O=3 the result will be :<br>[{t, 4, _}, {t, 5, _}]<br><br>For now I have to use an ordered_set table and the functions mnesia:last/1 and mnesia:prev/2, it works but the complexity is O(O). If I have to get some tuple from the middle of the table it will take long time.<br>
Is there an another solution than mine ?<br><br>Second question : How change the type of a table from set to ordered_set on an existing table ?<br><br><br>/Greg Burri<br></div>