how can initialize an array of arrays in vex?
i know in python would look like
my_array =
for i in range(4):
my_array.append()
print(my_array)
>>>[ , , , , ]
this is how i am trying to do in vex
int liners;
for(int l = 0; l < ch(“loops”); ++l){
int mini_liner;
push(liners, mini_liner);
};
but when i printf i just get
{}
and that's it i was expecting something like {{}, {}, {} }
how can initialize an array of arrays in vex?
5404 4 0- pelos
- Member
- 621 posts
- Joined: Aug. 2008
- Offline
- Aizatulin
- Member
- 495 posts
- Joined: July 2005
- Offline
Hi,
I think this is not possible in VEX . It would be very nice, if there were something like container classes/templates in VEX, to create custom arrays and the ability to gain control over more abstract structures. For example, if you want to sort an array of a special type in VEX it is very painful (As workaround in Python this quite easy). So what I am dreaming of are templates and functional programming stuff in VEX. But I know it will be a hard task to do that, since everything else has to be consistent.
I think this is not possible in VEX . It would be very nice, if there were something like container classes/templates in VEX, to create custom arrays and the ability to gain control over more abstract structures. For example, if you want to sort an array of a special type in VEX it is very painful (As workaround in Python this quite easy). So what I am dreaming of are templates and functional programming stuff in VEX. But I know it will be a hard task to do that, since everything else has to be consistent.
Edited by Aizatulin - Jan. 6, 2019 05:50:27
- bonsak
- Member
- 459 posts
- Joined: Oct. 2011
- Offline
You could hack it by using a matrix data type as your inner array:
But you will not get array functionality in the inner array.
Regards
Bonsak
matrix outsidearray[]; matrix insidearray = set(0,1,2,3,4,5,6,7,8); for(int i; i < 10; i++){ append(outsidearray, insidearray); } //float component = getcomp(outsidearray[0],0,0); printf('%g', outsidearray);
But you will not get array functionality in the inner array.
Regards
Bonsak
- pelos
- Member
- 621 posts
- Joined: Aug. 2008
- Offline
- bonsak
- Member
- 459 posts
- Joined: Oct. 2011
- Offline
-
- Quick Links