3 ms·
Does absence of arrays look a problem for you, while general immutability of most everything and message-based approach look totally normal and easy to grasp?
by nine_k 10y ago
Does absence of arrays look a problem for you, while general immutability of most everything and message-based approach look totally normal and easy to grasp?
I suspect that to use Elixir, you need to study a new way of doing things first. Then you'll see arrays in a different light.
- cutler 10y agoI have studied Elixir and other functional languages such as Clojure where vectors are 1 of the 3 basic collection types so the "new way of doing things" isn't an issue for me. Elixir took a lot of inspiration from Clojure so the 2 languages are not that different.
- nine_k 10y agoExpectedly, per Clojure documentation, "Vectors support access to items by index in log32N hops". This means that a Clojure vector is essentially a tree-based map; a "true" array (as in C or Java) would have O(1) time for access by index. I suspect that Elixir's maps are not different in this regard, as are Erlang's arrays, or maps in Haskell or OCaml. This is the canonical way to make an immutable map (see picture here: http://programmers.stackexchange.com/questions/195718/functional-programming-right-ideas-about-concurrency-and-state/195730#195730 http://programmers.stackexchange.com/questions/195718/functi...).