Dave Cragg wrote

>For example, imagine you have list of data (in a variable called 
>tData) that is 1000 lines long, and you have to do some processing of 
>each line. The following script can turn out be very inefficient:
>
>put the number of lines of tData into tNumLines
>repeat with i = 1 to tNumLines
>  ##do something to line i of tData
>end repeat
>
>The problem is that Metacard has to count out the lines until it 
>finds the right one *each time* through the loop. (At least, that's 
>my understanding.) So as i gets bigger, it takes longer to find the 
>line on each loop, and so an exponential time increase.

I use a lot of repeat loops and have not really considered efficiency 
until thi posting arrived.  The approach I use is as follows

put the number of lines of tData into x
put 1 into i
repeat x
  ##do something to line i of tData>end repeat
add 1 to i
end repeat

Would this overcome the problem stated by Dave?

Jim Wall


*******************************************
James C. Wall, Ph.D.
Professor
Department of Physical Therapy
University of South Alabama
1504 Springhill Avenue, Room 1214
Mobile AL 36604

        Phone:  (334) 434 3575
          Fax:  (334) 434 3822
       e-mail:  [EMAIL PROTECTED]


Archives: http://www.mail-archive.com/[email protected]/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.

Reply via email to