Selecting a range within an array?

Dar Scott dsc at swcp.com
Wed Apr 7 20:30:49 EDT 2004


On Wednesday, April 7, 2004, at 05:59 PM, Glen Bojsza wrote:

> I am stuck with arrays but I really would like to have a faster 
> solution... unless there is something that I'm missing??

Well, if the array is not in the context of 2D arrays, then you don't 
need the second index.  That might make calculating your key a little 
faster.

Also, your example of the speed of lines only applies to 1D.  If you 
were taking a sub matrix with specified min and max column and min and 
max row, you would have to take several chunks out.  Even so, there can 
be an advantage to contiguous data for many types of sub matrices.

Characters are even faster than lines.  I have used packed numbers 
using encode/decodeBinary in strings as matrices.  You might be more 
comfortable with a fixed number of characters.

Another approach is to rethink this.  Do you really need the sub array? 
  Maybe what you need is the indexes into an array in a global variable 
or some other specifier.

Dar Scott



More information about the use-livecode mailing list