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
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to