Arrays: new and old keys, i

Mark Brownell gizmotron at earthlink.net
Sun Sep 14 17:43:17 EDT 2008


>From: David Bovill <david at vaudevillecourt.tv>
>
>Mark you lost me on this thread somewhere:
>
>2008/9/14 Mark Brownell <gizmotron at earthlink.net>
>
>> We can have both worlds right now. If you need sorted and unsorted keys &
>> order of entry per dimensional layer or not all you need do is add layer [9]
>> assuming you will never need layer 9.
>
>Sorry what's layer 9?

"Layer 9" is a metaphor for attempting to picture multidimensional arrays as a structure like a cube. 

If you get used to placing the key's information as a comma delimited list, in the same arbitrary location of your dimensional arrays, then you can use the same code (or custom function) to work your magic. 

It could be myArray["keysLevel_2"][stringOfKeysInThisArrayOnThisLevel]

You don't have to think structurally about this. I just try to picture the data container. You can structure the entire thing as meaningful/relational. If you like/don't like that then make up another reality. Even more fun than all this is trying to explain all this to your clients. Even your tech writers are going to love it. I would always start with "it works, it works really good." 

>
>OK. I got some learning to do - what can we do now, and what is proposed
>regarding sorting of arrays? Also what's the difference between:
>
>put someValue after myArray [ someKey]
>
>and
>
>put someValue into myArray [ someKey]
>
>The former is new to me.
>

OK so you forced me to test the code before showing you:

on mouseUp
   put "" into field "results"
   put "hatTrick,rabbit drops,fish food,catfish bait," into myArray[9]["sortKeys"]
   put "fish stories" & "," after myArray[9]["sortKeys"]
   put myArray[9]["sortKeys"] & return & return into field "results"
   sort items of myArray[9]["sortKeys"] by word 1 of each
   put myArray[9]["sortKeys"] after field "results"
end mouseUp

hatTrick,rabbit drops,fish food,catfish bait,fish stories,

,catfish bait,fish food,fish stories,hatTrick,rabbit drops

----

I've exampled "into myArray" & "after myArray"

[!!! So it sorts inside the array. !!!] -- cool discovery

Ask the others what is proposed. 
It's mainly what they want. Read their past posts and sort that out.

I have exactly what I want now.

Mark Brownell







More information about the use-livecode mailing list