Problem description:
How do you access the length of a matrix without explicitly stating it in the definition?
mob
var
Matrix[][]
ID:1480536
Jan 25 2014, 9:32 am
|
|
Code:
Problem description: How do you access the length of a matrix without explicitly stating it in the definition? mob |
So is there no way to get flexible matrices?
Edit: Experimented with this #define DEBUG This is the best I could come up with for flexible matrices :/ |
I'm not sure what you mean by flexible, but a multidimensional list in DM is just a list of lists. If you want to change it's size, you just have to add/remove lists from it and resize the sub-lists.
multi <edit> Changed it to rows,columns instead of columns,rows. Makes it easier to visualize. You can think of your matrix like this: // col 1 col 2 col 3 |
If you want to create a multi-dimensional list, either put the dimensions in the brackets, or use new/list(x,y)