<html><head></head><body><div style="color:#000; background-color:#fff; font-family:Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:13px"><div id="yui_3_16_0_ym19_1_1507129101941_479263"><span id="yui_3_16_0_ym19_1_1507129101941_479264">Either im completely missing the point or this has been in core erlang for a long time.<br><br>ets ordered_set.<br><br></span></div><div dir="ltr" style="font-family: "Helvetica Neue", "Segoe UI", Helvetica, Arial, "Lucida Grande", sans-serif;" id="yui_3_16_0_ym19_1_1507129101941_479269">> * allows custom compare function to order the data in a specific order<br><br>Setup a key tuple instead of custom compare function. If you need to sort by values pull those out into the key tuple.<br><br id="yui_3_16_0_ym19_1_1507129101941_479270"></div><div dir="ltr" style="font-family: "Helvetica Neue", "Segoe UI", Helvetica, Arial, "Lucida Grande", sans-serif;" id="yui_3_16_0_ym19_1_1507129101941_479271">> * allows the user to iterate forward (next) and backward (prev) the data><br><br>ets:next|prev</div><div dir="ltr" style="font-family: "Helvetica Neue", "Segoe UI", Helvetica, Arial, "Lucida Grande", sans-serif;" id="yui_3_16_0_ym19_1_1507129101941_479273"><br id="yui_3_16_0_ym19_1_1507129101941_479274"></div><div id="yui_3_16_0_ym19_1_1507129101941_479276"></div><div dir="ltr" style="font-family: "Helvetica Neue", "Segoe UI", Helvetica, Arial, "Lucida Grande", sans-serif;" id="yui_3_16_0_ym19_1_1507129101941_479275">> Has someone already written a lib that offers such datastructure? Or maybe we can add a `prev(Key) function to gb_tree? Any idea i welcome :)<br><br>Only part that this does not fit is the requirement for a custom compare function. If the custom compare is very complex, itl be very expensive regardless and wont scale. If the custom compare is simple, a tuple key should replace it.</div> <div class="qtdSeparateBR"><br><br></div><div class="yahoo_quoted" style="display: block;"> <div style="font-family: Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 13px;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div dir="ltr"><font size="2" face="Arial"> On Monday, October 9, 2017 6:24 AM, Frank Muller <frank.muller.erl@gmail.com> wrote:<br></font></div> <br><br> <div class="y_msg_container"><div id="yiv1211138367"><div><div><div>Benoit,</div><div><br clear="none"></div><div>It’s called “Judy Array” and Erlang bindings do exist:</div><div><a rel="nofollow" shape="rect" target="_blank" href="https://github.com/knutin/judy">https://github.com/knutin/judy</a><br clear="none"></div><br clear="none"><div class="yiv1211138367gmail_quote"><div>You can search for next/previous elements and do stuffs no other hashing libs support.</div><div><br clear="none"></div><div>/Frank</div><div><br clear="none"></div><div class="yiv1211138367yqt8364863214" id="yiv1211138367yqt13971"><blockquote class="yiv1211138367gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I’m didn’t find anything that fit my need. There are some btree libs but that doesn’t fit my needs. Also a tree is not that fast for memory imo. I’m thinking to build a red-black tree lib that support iterations for it. Red-black trees look simple enough to be build as a pure functional data structure. Still contemplating though.<br clear="none">
<br clear="none">
Benoit<br clear="none">
<br clear="none">
> On 9 Oct 2017, at 09:52, Billy Svensson <<a rel="nofollow" shape="rect" ymailto="mailto:billy.svensson@gmail.com" target="_blank" href="mailto:billy.svensson@gmail.com">billy.svensson@gmail.com</a>> wrote:<br clear="none">
><br clear="none">
> I've needed this in the past too. Couldn't find any lib that could do<br clear="none">
> it so I just ported the floor and ceiling methods of the TreeMap class<br clear="none">
> in Java to an Erlang module that operated on a gb_tree.<br clear="none">
> It's a bit ugly though since you have to work on the "hidden" data<br clear="none">
> structure of the gb_trees module, so would be great if this could be a<br clear="none">
> part of the standard module instead.<br clear="none">
><br clear="none">
> Not sure I still have that code, but could try to find it if you want.<br clear="none">
> You would probably need to test it a bit better though since I only<br clear="none">
> used it for a small hobby project.<br clear="none">
><br clear="none">
> On Sun, Oct 8, 2017 at 8:21 PM, Benoit Chesneau <<a rel="nofollow" shape="rect" ymailto="mailto:bchesneau@gmail.com" target="_blank" href="mailto:bchesneau@gmail.com">bchesneau@gmail.com</a>> wrote:<br clear="none">
>> hmm i forgot to mention i need to also lookup for the data so not sure if a<br clear="none">
>> zipper is designed for it.<br clear="none">
>><br clear="none">
>> I will have a loom kn the libs anyway, thanks for the links :)<br clear="none">
>><br clear="none">
>> - benoît<br clear="none">
>><br clear="none">
>> On 8 Oct 2017, at 19:33, Dmitry Kolesnikov <<a rel="nofollow" shape="rect" ymailto="mailto:dmkolesnikov@gmail.com" target="_blank" href="mailto:dmkolesnikov@gmail.com">dmkolesnikov@gmail.com</a>> wrote:<br clear="none">
>><br clear="none">
>> Hello,<br clear="none">
>><br clear="none">
>> It looks like you are looking for data structure called zipper. I’ve not<br clear="none">
>> used any of these but there is at least two versions of zippers for Erlang.<br clear="none">
>><br clear="none">
>> <a rel="nofollow" shape="rect" target="_blank" href="https://github.com/ferd/zippers">https://github.com/ferd/zippers</a><br clear="none">
>> <a rel="nofollow" shape="rect" target="_blank" href="https://github.com/inaka/zipper">https://github.com/inaka/zipper</a><br clear="none">
>><br clear="none">
>> - Dmitry<br clear="none">
>><br clear="none">
>><br clear="none">
>> On 8 Oct 2017, at 20.14, Benoit Chesneau <<a rel="nofollow" shape="rect" ymailto="mailto:bchesneau@gmail.com" target="_blank" href="mailto:bchesneau@gmail.com">bchesneau@gmail.com</a>> wrote:<br clear="none">
>><br clear="none">
>> Hi all,<br clear="none">
>><br clear="none">
>> I’m looking for a datastructure like a skiplist to maintain an ordered set<br clear="none">
>> of Key/Values. It has to have the following properties:<br clear="none">
>><br clear="none">
>> * allows custom compare function to order the data in a specific order<br clear="none">
>> * allows the user to iterate forward (next) and backward (prev) the data<br clear="none">
>><br clear="none">
>> Has someone already written a lib that offers such datastructure? Or maybe<br clear="none">
>> we can add a `prev(Key) function to gb_tree? Any idea i welcome :)<br clear="none">
>><br clear="none">
>> - benoit<br clear="none">
>> _______________________________________________<br clear="none">
>> erlang-questions mailing list<br clear="none">
>> <a rel="nofollow" shape="rect" ymailto="mailto:erlang-questions@erlang.org" target="_blank" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br clear="none">
>> <a rel="nofollow" shape="rect" target="_blank" href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a><br clear="none">
>><br clear="none">
>><br clear="none">
>><br clear="none">
>> _______________________________________________<br clear="none">
>> erlang-questions mailing list<br clear="none">
>> <a rel="nofollow" shape="rect" ymailto="mailto:erlang-questions@erlang.org" target="_blank" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br clear="none">
>> <a rel="nofollow" shape="rect" target="_blank" href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a><br clear="none">
>><br clear="none">
<br clear="none">
_______________________________________________<br clear="none">
erlang-questions mailing list<br clear="none">
<a rel="nofollow" shape="rect" ymailto="mailto:erlang-questions@erlang.org" target="_blank" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br clear="none">
<a rel="nofollow" shape="rect" target="_blank" href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a><br clear="none">
</blockquote></div></div></div></div></div><div class="yqt8364863214" id="yqt70962">_______________________________________________<br clear="none">erlang-questions mailing list<br clear="none"><a shape="rect" ymailto="mailto:erlang-questions@erlang.org" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br clear="none"><a shape="rect" href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br clear="none"></div><br><br></div> </div> </div> </div></div></body></html>