4 ms·
Tuples are the BEAM's native arrays, but they're expensive to update, immutability means you (usually) have to copy the whole thing to update one index. Lists a
by ramchip 2y ago
Tuples are the BEAM's native arrays, but they're expensive to update, immutability means you (usually) have to copy the whole thing to update one index. Lists are a lot more common in functional languages.
If you really need random access you can use a map with integer keys. If you want to write numerical stuff, Elixir has Nx - not sure if it's usable from Gleam though.