"repeat for each" in reverse order ?
Dennis Brown
see3d at writeme.com
Wed Jun 29 19:27:36 EDT 2005
Wouter,
While some variation on the example I showed could be useful and
faster than some other possible script variations, all the high level
script commands to simulate low level operations are a speed killer
relative to the speed of a native method. The repeat for each is
truly awesome in its speed, and that is the speed that I would like
to see in a more flexible primitive.
Dennis
On Jun 29, 2005, at 7:16 PM, Buster wrote:
> Hi Dennis,
>
> I'm just curious, but what is wrong with itemOffset?
>
> Greetings,
> Wouter
>
>
>
>> Re: "repeat for each" in reverse order ?
>> Dennis Brown
>> Tue, 28 Jun 2005 07:59:41 -0700
>>
>> What I would like to see is a way to access the next or previous
>> "element" in a list independent of the repeat structure. We have
>> something similar in the offset function --offset
>> (findString,searchString,skipChars). The key is to have a concept
>> for a pointer of sorts. The pointer in the offset function is the
>> skipChars parameter. You could just about simulate this capability
>> using the offset function (not tested):
>>
>> global gStringName,gStringNamePtr
>> function nextItemStringName --don't want to pass the actual strings
>> get offset(itemDel(), gStringName, gStringNamePtr)
>> if it = 0 then --delimiter not found, must be end of string
>> return char gStringNamePtr to -1 of gStringName --last item in the
>> string, or empty
>> else
>> return char gStringNamePtr to gStringNamePtr +it-1 of gStringName
>> --grab the next item put it+1 into gStringNamePtr --advance the
>> pointer to after the delimiter
>> end if
>> end nextItemStringName
>>
>> Of course this way of doing it is not so general, a bit awkward,
>> and the function calls would kill a lot of the potential speed.
>> That is why a built-in function would be much better. Perhaps a
>> syntax something like this:
>>
>> nextItem(stringName,charOffsetVar)
>>
>> The variable name specified for the charOffsetVar would have the
>> pointer that gets modified.
>>
>> You could also make it a command something like:
>>
>> nextThing stringName with charOffsetVar by item
>>
>> Having sequential access methods like this would allow a much
>> greater freedom to process one or more lists at the same time
>> without suffering the usual speed penalties.
>>
>> Dennis
>>
>
> _______________________________________________
> 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