Usually (so far always) I try to use immutable collection in Scala, especially so that if I give a reference to a collection to some other part of my program I cannot override the original source by accident. Using breeze, I would like to know: Why was it decided to have DenseVector be a mutable collection?
Is this just a (maybe unwanted) side effect of using in Arrays in the background? If so, why were Arrays used, instead of another (immutable) collection?
a=c(1,2); b=a; a[1]=0
in R,a
will be0 2 3
while b will be1 2 3
. The equivalent in Scala would be an immutablevar
. – Captive