3 ms·
The answer to your very good question is beyond the scope of what can be covered in an HN post, so I would suggest that you look at http://en.wikipedia.org/wiki
by jerf 17y ago
The answer to your very good question is beyond the scope of what can be covered in an HN post, so I would suggest that you look at http://en.wikipedia.org/wiki/Purely_functional http://en.wikipedia.org/wiki/Purely_functional for a quick answer, or http://www.cs.cmu.edu/~rwh/theses/okasaki.pdf http://www.cs.cmu.edu/~rwh/theses/okasaki.pdf for a more in-depth answer. After that, you'll know what to Google for. I particularly recommend the discussion of tree updates in the Wikipedia article to start with, since it has good diagrams.
That said... multidimensional arrays continues to be a sore point with functional programs, as far as I know. A variety of purely functional structures exist that can replicate some parts of the performance guarantees of traditional arrays, but I am not aware of anything that can cover the full gamut of uses for a multidimensional array. Usually in this case there is a functional structure that does what you really need, but ISTM that when you find yourself needing a multidimensional array, it's because A: it's huge B: you need fast O(1) updating and C: you need fast O(1) access and that combo is just killer. (And nowadays, D: you need cache coherence control comes up too.)
Oh, and if I'm reading your question correctly, Erlang process isolation is not really related to your question. However, I will point out that in Erlang, two processes will not access the database "at the same time". Two processes will send messages to the database Erlang-process, which will serve them in order and send back the replies. When processes and messaging are cheap you change how you do things; a lot more things get wrapped in processes (files, socket connections, foreign libraries, pipes to externally running programs ("ports" in Erlang speak, rather unfortunately), etc.) than you'd expect. It's the fundamental primitive for avoiding contention, it gets used a lot!