"repeat for each" in reverse order ?

Dennis Brown see3d at writeme.com
Mon Jun 27 08:40:08 EDT 2005


The repeat for each only goes in forward sequential order starting at  
the beginning, except for arrays where the order is indeterminate.

I have requested a sequential access enhancement to allow for  
constructing this type of looping in a more flexible way (like  
parallel instantiation, starting at an arbitrary point, and reverse  
order), to make it possible to wander all over your data sequentially  
with the speed of the repeat for each method.  However, it would be  
most useful with some improved string delimiter handling.  Bugzilla #  
2773

Having a reverse order repeat for each might be up to twice as slow  
as the forward version depending on how it is implemented, because it  
has to go backwards to the previous delimiter then forward to pick up  
the data, though it could pick up the data in reverse order on the  
way back.  However, even twice as slow would be much faster than any  
other method.

Dennis

On Jun 27, 2005, at 3:57 AM, Robert Brenstein wrote:

>> It sounds like you're looking for a feature that doesn't yet exist  
>> (or at least I'm not aware of it). I could see having a property  
>> that defines the direction in which the 'repeat for each'  
>> structure does its looping, like this:
>>
>>   set the repeatDirection to "descending" -- or "down",  
>> "reverse", ???
>>   repeat for each element x in y
>>     -- actions
>>   end repeat
>>
>> That would be a nice feature indeed. No harm in requesting it!
>>
>> Phil Davis
>>
>
> I would prefer
>
>   repeat for each element x in y descending
>
> but I doubt whether this would have the performance anywhere close  
> to ascending 'for each' so it is probably pointless to have it. As  
> far as I know, the speed of 'repeat for each' comes from processing  
> elements sequentially and thus without having to recalculate the  
> list pointer position.
>
> Robert
> _______________________________________________
> 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