So im running this code in playground of pharos 6.0 and it gives me an error saying "unindex object is not access able. Basically, I'm trying to make a matrix that is 8x10. How do I make one?
| aMatrix row col|
aMatrix := Matrix new.
aMatrix numberOfColumns: 3.
aMatrix numberOfRows: 3.
aMatrix at: 2 at: 2 put: 6.
If you try to make a matrix 8x10 why do you do
aMatrix numberOfColumns: 3.
aMatrix numberOfRows: 3.
?
I checked the code, and I don't get why it is implemented the way it is implemented. numberOfColumns:
and numberOfRows:
just assign the parameter to an instance variable, but don't change the internal data structure.
You should do something like:
aMatrix := Matrix rows: 8 columns: 10.
aMatrix at: 2 at: 2 put: 6.