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