<html><head></head><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yui_3_16_0_ym19_1_1476761927128_303815" dir="ltr">This seems like something for ETS table to solve. ETS tables are very flexible and there are countless ways to get them to do different things.<br><br>When in doubt for performance, you could always write a C NIF. Don't forget to compile with o3.</div> <div class="qtdSeparateBR"><br><br></div><div class="yahoo_quoted" style="display: block;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <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 Friday, October 21, 2016 5:41 PM, Karlo Kuna <kuna.prime@gmail.com> wrote:<br></font></div> <br><br> <div class="y_msg_container"><div id="yiv9697239575"><div dir="ltr">i want to implement what i call Select-Consume function:<div><br></div><div>take list of lists [L1 ... Ln]</div><div>select some (potentially all) heads from L1 ... Ln and do something with them </div><div>recurse with tails of lists where selection happened and with complete lists where there wasn't selection preserving original order </div><div>end when all L1 ... Ln are exhausted or when there was no selected heads.</div><div><br></div><div>my worry is about performance, as far as i know in erlang there is no way to coordinate traversal of multiple lists! </div><div>i looked at implementation of lists module and there i found horror of manual implementation of case combinatorics in merge/3</div><div>which obviously does not scale at all. </div><div>i am also aware that forwarding strategy in my case is making new list every time, which is BAD but i don't know of any other way </div><div>to handle variadic function call other than passing list of arguments (in my case list of lists)</div><div><br></div><div>i'm wandering is my problem somewhat "hard" for erlang and what are solutions if any ?? </div><div> </div><div>thanks for any help </div><div><br></div><div>Kuna Prime</div><div><br></div><div><br><div><br></div><div><br></div></div></div></div><br>_______________________________________________<br>erlang-questions mailing list<br><a ymailto="mailto:erlang-questions@erlang.org" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br><a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br><br><br></div> </div> </div> </div></div></body></html>