Hacker News new | ask | show | jobs
by paulcsmith 3132 days ago
Can you explain a bit more what you mean? What advantages do "Python variety" lists give you over what Elixir does with lists and tuples?
1 comments

Python's lists are really arrays/vectors as in Ruby ie. well-optimised for index-based access. Erlang/Elixir lists are linked lists which are more optimised for appends than index-based access though you can achieve the same with Enum.at(list, index). With small lists/arrays the difference isn't noticeable but it will affect performance with large lists.
If we're being honest, Python lists aren't arrays either, they are arrays of pointers which need to be unboxed before using. If you really really need array performance, then drop down to c, or use a language like Julia. Lists give you the ability to quickly pass these structures as immutable objects, which in turn, you want because of safety guarantees in concurrent environments.
The lack of true arrays or vectors haven’t been an issue for me across a couple of domains. Of course maps can always be used as indexed based lookups for mid-sized problems (similar to lua’s combined array/map type).

What problems have you been facing where it’s an issue? It’d be nice to know to avoid said problems upfront.

Arrays and vectors are different. I’d suggest adhering to C-like conventions of data structures.