My question is how arrays implemented in Erlang, as opposed to lists.
With immutable types doing things like
move ([X | Xs], Ys) -> [X | Ys]. Ls = move([1,2,3], [2,3,4])
will accept permanent memory on the heap, since this is all the reference work.
But for the same material in arrays
move (A1, A2) -> array:set(0, array:get(0,A1),A2). A1 = array:from_list([1,2,3]). A2 = array:from_list([0,2,3,4]). A3 = move(A1,A2).
Will move use a size proportional to A2, or will he be able to do this in a constant space, for example, with arrays?
source share