Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: Axenntio on March 14, 2014, 05:42:03 pm

Title: Array in Axe
Post by: Axenntio on March 14, 2014, 05:42:03 pm
Hi community, Axenntio here !

Recently, I understood the utilisation of the List in axe (with the { } and the incrementation of the pointer).
But there is possible to use them or the matrix to have an Array ? like (in C++):

int world[12][8];

Thanks for futur reply.

Sorry for my english... Don't hurt me, I've cookies :3
Title: Re: Array in Axe
Post by: josh landers on March 14, 2014, 06:00:05 pm
Thats not a list. Its a way of saying that you want the byte in that pointer. Lets ues the alphabet as an example for this.
ABCDEF
is in pointer K
If you use {K+3}
You get
D
Why? If this was not a group of letters but lets say a string it get the third byte in the string.
Ok now thats covered. You could have a "matrix" but it would really just be like a list.
TI-OS syntax for lists and matrix use "," between element. You have to use bytes.
Example:
Matrix:
[4,8,3]
[2,4,7]
Is really just
(4 8 3 2 4 7)->P
And to get the element you need just use {P+#}
Smarter people please correct if needed!
Hope this helps!
Title: Re: Array in Axe
Post by: Hayleia on March 14, 2014, 06:20:01 pm
Well that's right.
When you do

[]→°Matrix
[040803]
[020407]

It is the same as

[040803020407]→°Matrix

Now, to access the "X,Y" byte (start from 0), just do {Y*width+X+°Matrix}
Title: Re: Array in Axe
Post by: Axenntio on March 14, 2014, 06:30:28 pm
Thanks, the quality of reply is awesome on Omnimaga :D

Thanks josh landers and Hayleia :3