There are also easy workarounds to that (including NIFs), I personally never needed arrays in Elixir
Of course if your goal is to re-implement sorting algorithms that were designed for mutable memory, you will be disappointed.
This isn't a deal-breaker. If you want a platform language, use that. But for web, you'd be hard-pressed to find something better suited than Elixir.
Just not used across the language
Tuples and binaries give O(1) read access, so depending on your use case, they may be better.
Also look at zippers, finger trees and ropes for more dynamic use, especially local operations (cursors).
O(1) for reading I believe. The slightly awkward array module is built on top of tuples, a 10-tree of tuples? or something like it.
But good point, once in a while I see list_to_tuple to provide faster indexed reads on lists.
https://www.erlang.org/doc/system/system_limits
There is also some hope that future versions of the Erlang compiler will allow mutable O(1) update of tuple elements through setelement (code inside a process is - almost - guaranteed not to have shared references).
Safe destructive update of tuples has been implemented
in the compiler and runtime system. This allows the VM to
update tuples in-place when it is safe to do so, thus
improving performance by doing less copying but also by
producing less garbage.
https://github.com/erlang/otp/releases?q=27&expanded=trueIt should be possible to add Elixir syntactic sugar to make this more concise and natural.
https://www.erlang.org/doc/apps/stdlib/array.html
https://hexdocs.pm/arrays/Arrays.html
Also, if it's read heavy, you can use use tuples for O(1) access.
Besides all that, the community is extremely helpful, if you have questions check out the forum, for example on this very topic there's quite a bit of helpful discussion
https://elixirforum.com/t/elixir-array-like-data-structure/2...
That's exactly what JavaScript does (as I understand it), but it hides it from you. And the implementation authors have optimized it over the years.
https://stackoverflow.com/questions/5048371/are-javascript-a...
Also why with time, I learned to stay with platform languages, even if they aren't as shinny, or have warts that in hindsight could have been done better.