Arrays in Rev

Dar Scott dsc at swcp.com
Sun Jul 11 17:20:40 EDT 2004


On Jul 11, 2004, at 1:31 PM, Troy Rollins wrote:

> In Director, it is VERY common to have extremely deeply nested arrays, 
> often with tens of thousands of items dispersed across many layers of 
> array nesting. These nested arrays can contain both associative 
> arrays, and linear lists, and those in turn can contain either as 
> well, and so on. Contents of these lists are easily target-able, and 
> very rapidly accessible.
>
> How is this done in Transcript, if at all? If not, what is the logical 
> replacement? In some cases, I've gone to generating stacks and using 
> cards to organize such data, but would prefer a variable structure for 
> the speed, especially considering that the user never has to actually 
> see the data in the stored/working form.

Multidimensional arrays are in an assigned enhancement on bugzilla.  
The direction of implementation seems to be essentially nested arrays.  
(Bugzilla 555)  These will participate in chunk syntax to any level, I 
think.

You can make some functions to create number subscripted matrices and 
for fixed size data these can get data in fixed time.  Starting with 
2.3, you can set these in almost constant time.  (Bugzilla 586)  I have 
not tested this change.  You essentially pack data into a string and 
use functions to retrieve it and stuff it back in.

I have created a chunk abstraction that can handle nesting and any kind 
of data.  I call it a box.  Andre seems to be a fan of boxes.  If 555 
does not come out in 2.3, I may clean that up and make it more 
available.  Access time is proportional the number of boxes from the 
end.

Dar Scott



More information about the use-livecode mailing list