On Saturday, June 4, 2016 at 5:05:47 PM UTC-4, Christopher Fisher wrote: > > Thanks Ford. Is there a reason you discourage using symbols? I opted for > the symbols partly because I couldn't get your example to work. So I > combined code from the various answers until something worked. > > I also noticed some odd behavior with the present implementation and I > think its part of the reason I am having difficulty understanding all of > the syntax. For example, overwriting values works both ways: > population[:history,1][1] = 20 or population[:history][1][1] = 20. However > the other properties do not work with both indexing schemes. It only works > with population[:infected,1] = 20. >
That's because population[:infected] makes a copy of the data. With history, it works because Arrays are mutable types (so basically you are just getting a pointer to the same data).