Thread: Array questions
View Single Post
Thought you were Dead
Old
MrMoke
Senior Member
 
MrMoke's Avatar
 
Status: Offline
Posts: 501
Join Date: Sep 2007
Location: Austin, Texas
Default Thought you were Dead - 07-18-2014, 03:37 PM

Welcome Back JRR-
Arrays are pretty much the same in all programming languages. They are fixed length constructs of items that all have to be the same type. In older languages that meant all characters, integers, or Floating point values. In newer languages that definition has been expanded, but the rules are the same.
An array has a predefined length, which cannot be changed. Each item can be accessed and/or replaced by assigning a specific value to the array's index pointer, then manipulating the referenced memory location. Accessing and/or storing information from multiple same-size arrays with the same index value, has been used for a long time in programming.

A one-dimensional array, like those in Alice, might hold something like all the integers from 0 to 9.

A two-dimensional array, which could be visualized as a box, might contain something like all of the pixels on your monitor, so accessing monitor(x,y) might access the pixel in row x, col y, or vice-versa depending how the programmer set it up.

A three-dimensional array could hold all the data points in an Alice World.

Any arrays larger than that makes my head hurt because it involves time travel

Lists look the same, and can be accessed in the same manner, but are somewhat more pliable in that the length is not fixed once they have been created. You can add, modify, and delete items from any position. Because of this, the length of a list can vary from moment to moment, so care must be taken when trying to use then the same way as an array.

In Alice, lists are given special attention when using commands like "For All Together", "For All In Order", etc.

Last edited by MrMoke; 07-22-2014 at 01:31 PM.
   
Reply With Quote