Delete an Array Entry?

Dave dave at looktowindward.com
Fri Mar 2 09:41:17 EST 2007


Hi,

Please see comment below regarding the documentation in RunRev.

All the Best
Dave

On 3/2/07, Dave <dave at looktowindward.com> wrote:

Whoever wrote the

> documentation didn't understand how Arrays in RunRev work. If they
> had been called something less confusing then the problem  would not
> have arisen and I wouldn't have wasted time!
>


Having neither programmed in SNOBOL4 of SPTOBOL I have no clue as to  
what
pitfalls await those who have when they come across to Rev, but you  
may wish
to take up the invitation on the very first page of the Rev Docs:

Please send all comments and feedback to:
userguide at runrev.com
All comments will be read and you will receive a reply.


> From my perspective I don't believe that changing the name from  
> Array to
>
Table would solve much if the example still uses the number 17. If the
example was:

delete global myTable[seventeen] --removes the element whose key is
'seventeen' from the array

I believe would not have wasted your time, but then again I haven't  
come to
Rev with your background so I'll leave it up to you as to what send to
userguide at runrev.com to help others not fall into the same trap you  
have.
_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your  
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

On 2 Mar 2007, at 11:57, Dave wrote:

>
> On 1 Mar 2007, at 19:02, J. Landman Gay wrote:
>
>> Dave wrote:
>>
>>> When I read the part quoted above in the documentation I thought  
>>> for a moment that myArray[17] was some special usage and wasted  
>>> times checking that it worked the way I thought it worked. There  
>>> is really no point in describing the RunRev type of Array in  
>>> these terms since there is no element 17 or any other numeric index.
>>
>> Under "delete variable", the docs say: "The arrayIndex is a key of  
>> an array variable. If an arrayIndex is specified instead of a  
>> variable name, the delete variable command removes that element of  
>> the array, without deleting the rest of the elements in the array."
>>
>> It seems pretty clear that the delete command will remove an array  
>> element with the key you specify. That's how associative arrays work.
>
> The Documentation says:
>
> delete global myArray[17] -- removes 17th element of that array
>
> Does this delete the 17th element of the array? No (except if "17"  
> just happens to be at position 17). Therefore it's wrong. It makes  
> no sense at all to talk about numeric values to "index" into a  
> RunRev based array. There is really no such thing as the 17th (or  
> any other index) in an RunRev array.
>
> The documentation is unclear. It should read:
>
> delete global myArray[17] -- removes the array element whose key is  
> "17".
>
> note: the use of 17 here does not refer to a numeric index, but  
> rather to a key that is used to look up the element in the array.  
> It is possible to use the array in a similar fashion to the more  
> traditional array found in languages such as C and Pascal since  
> RunRev converts the numeric value to a string automatically.
>
> Or something like that!
>
>>> Whoever wrote the documentation didn't understand how Arrays in  
>>> RunRev work.
>>
>> That would be hard to believe. Jeanne DeVoto, who wrote most of  
>> the documentation, is one of the foremost documentation experts on  
>> xtalk scripting, starting with HyperCard, where she was one of the  
>> authors of the definitive reference book for that program. She has  
>> been working with the language for 20 years, and I'm certain she  
>> understands how arrays work in Revolution. But if you haven't  
>> worked much with associative arrays, I can see how it could be  
>> confusing.
>
> Well he should have known better then!
>
> Have a great weekend - I know I will!
> All the Best
> Dave
>
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list