|
|
|
|
|
by farginay
4572 days ago
|
|
It's interesting to see how the array programming languages have handled this. The way it works (loosely) is that everything is an array. A scalar is kind of a degenerate array, and a vector is an array of rank 1. Matrices can be seen as arrays of arrays of arrays.. Each operator defines its extent. The count operator '#' in J works at the top level. If you have a 3 x 4 matrix, it returns 3. Take '{.' works the same way. If you have a 3 x 4 matrix and you take 1, you will get a 4 element vector which is the first row of the matrix. Something like decrement '<:' applies to all of the elements in a matrix regardless of the dimensionality. This isn't like OO where collections have operations attached to them. |
|