[erlang-questions] traversal of multiple lists (or list of lists)

Karlo Kuna kuna.prime@REDACTED
Sat Oct 22 21:19:42 CEST 2016

i thought about NIFs but this is option of last resort

ETS seems like something i would never imagine for this use case but i'll
@Vans could you explain your thinking bit further?

On Sat, Oct 22, 2016 at 4:30 PM, Vans S <vans_163@REDACTED> wrote:

> 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.
> When in doubt for performance, you could always write a C NIF. Don't
> forget to compile with o3.
> On Friday, October 21, 2016 5:41 PM, Karlo Kuna <kuna.prime@REDACTED>
> wrote:
> i want to implement what i call Select-Consume function:
> take list of lists [L1 ... Ln]
> select some (potentially all) heads from L1 ... Ln and do something with
> them
> recurse with tails of lists where selection happened and with complete
> lists where there wasn't selection preserving original order
> end when all L1 ... Ln are exhausted or when there was no selected heads.
> my worry is about performance, as far as i know in erlang there is no way
> to coordinate traversal of multiple lists!
> i looked at implementation of lists module and there i found horror of
> manual implementation of case combinatorics in merge/3
> which obviously does not scale at all.
> 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
> to handle variadic function call other than passing list of arguments (in
> my case list of lists)
> i'm wandering is my problem somewhat "hard" for erlang and what are
> solutions if any ??
> thanks for any help
> Kuna Prime
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20161022/a50ea95a/attachment.htm>

More information about the erlang-questions mailing list