<div dir="ltr"><div class="gmail_quote"><div dir="ltr">Max Lapshin <<a href="mailto:max.lapshin@gmail.com">max.lapshin@gmail.com</a>> schrieb am Do., 13. Dez. 2018 um 10:06 Uhr:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr">Erlang ets with ordered_set mode has very cool feature: partially bound tuple primary key that allows to use ets as a good old binary tree.<div><br></div><div>I haven't found any good explanations of how to use, so have written some draft of post:</div><div><a href="https://medium.com/@max.lapshin/how-we-adopted-partial-ordered-set-in-erlang-782f773349f4" target="_blank">https://medium.com/@max.lapshin/how-we-adopted-partial-ordered-set-in-erlang-782f773349f4</a></div></div></div></blockquote><div><br></div><div>You don't need to play tricks with ets:fun2ms/1. It is mostly a helper so that you don't have to think to much about the structure of a match spec yourself. But, you can still construct the same spec manually.</div><div><br></div><div>So, instead of:</div><div><br></div><div><div><font face="monospace"> ets:fun2ms(fun (#segment{utc={_,_,_}} = Segment) -> true end)</font></div></div><div><br></div><div>You can simply use:</div><div><br></div><div><div><font face="monospace"> [{#segment{utc = {'_','_','_'}, _ = '_'}, [], [true]}]</font></div></div><div><br></div><div>Or to use your sample:</div><div><br></div><div><div><font face="monospace"> match_spec_hour(Name, Hour, true) -></font></div><div><font face="monospace"> [{#segment{utc = {Name,Hour,'_'}, _ = '_'}, [], [true]}];</font></div><div><font face="monospace"><br></font></div><div><font face="monospace"> match_spec_hour(Name, Hour, segment) -></font></div><div><font face="monospace"> [{#segment{utc = {Name,Hour,'_'}, _ = '_'}, [], ['$_']}].</font></div></div><div><br></div><div>Regards<br></div><div>Andreas</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div><br></div><div><br></div><div>Would be glad for any feedback.</div></div></div>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><span style="font-family:monospace,monospace">-- <br>Dipl.-Inform. Andreas Schultz<br><br>----------------------- enabling your networks ----------------------<br>Travelping GmbH Phone: +49-391-81 90 99 0<br>Roentgenstr. 13 Fax: +49-391-81 90 99 299<br>39108 Magdeburg Email: <a href="mailto:info@travelping.com">info@travelping.com</a><br>GERMANY Web: <a href="http://www.travelping.com">http://www.travelping.com</a><br><br></span><div><span style="font-family:monospace,monospace">Company Registration: Amtsgericht Stendal Reg No.: HRB 10578</span></div><span style="font-family:monospace,monospace">Geschaeftsfuehrer: Holger Winkelmann VAT ID No.: DE236673780<br>---------------------------------------------------------------------</span></div></div>