Arrays: new and old keys

Mark Brownell gizmotron at earthlink.net
Fri Sep 12 12:06:30 EDT 2008


>Subject: Re: Arrays: new and old keys
>
>Then there is the whole question of hierarchical structures as  
>discussed so far.
>
>>
>> Can anybody explain what the new array format provides that the old  
>> did not?  All these bizarre examples seem not so much as  
>> exemplifying the ``new'' features as to leave me baffled as to what  
>> added value they provide.  In NONE of the supposed or alleged  
>> examples have I seen anything I could not do with old arrays.  So,  
>> and I mean in really simple language (not OOP-speak), wtf is up  
>> with these new arrays?  I see nothing but extra brackets.

Let's look at knowing XML hierarchical structures and not knowing them.

If you are passing or storing sales catalog data that you know the hierarchical structure of then you can populate your multidimensional array numerically by use of a pull parser. If parsing unknown XML then examining the hierarchical structure of the XML is the only way to go. You are better off not using a pull-parser. You can use numerically structured known multidimensional array structures to create known XML hierarchical structures. In all that you have a database of stored data in your running software and as XML your database is stored as same structured XML. With a pull-parser you can collect all the data that applies to any catalog number (not a sequential number of an array location) in your XML. With the same kind of pull-parser logic you can store each item in the catalog with a combined form of numerical and relational keys.

put myArray["#476532"][4][3] into shippingPriceWestCoast

You can imagine the XML equivalent to this:

<item number="["#476532">
 <category>Wheel Parts</category>
 <description>"blah blah"</description>
 <cost>$249.99</cost>
 <shipping>
  <east></east>
  <middle></middle>
  <west>$12.55</west>
 </shipping>
</item>

That's one way that I use dimensional XML/data/array structures. You can even compress & base64 binary data and store it in this way. When you know the structure formation type then you have very fast and powerful access.







More information about the use-livecode mailing list