Author Topic: Array in Axe  (Read 2374 times)

0 Members and 1 Guest are viewing this topic.

Offline Axenntio

  • LV3 Member (Next: 100)
  • ***
  • Posts: 41
  • Rating: +3/-0
    • View Profile
Array in Axe
« 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

Offline josh landers

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 116
  • Rating: +1/-0
    • View Profile
Re: Array in Axe
« Reply #1 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!

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Array in Axe
« Reply #2 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}
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Axenntio

  • LV3 Member (Next: 100)
  • ***
  • Posts: 41
  • Rating: +3/-0
    • View Profile
Re: Array in Axe
« Reply #3 on: March 14, 2014, 06:30:28 pm »
Thanks, the quality of reply is awesome on Omnimaga :D

Thanks josh landers and Hayleia :3