I'd also be careful of:
repeat with i = 1 to thisList.count
because this is depending upon thisList to not change size, and is actually
slower than:
iMax = thisList.count
repeat with i = 1 to iMax
because you're not accessing the .count of the list multiple times.
roymeo
[To remove
At 21:18 2002-09-21, Colin Holgate wrote:
on repeatList aList
repeat with i in aList
put aList.getPos(i)
end repeat
end
Buzz's hidden counter will work, but this one may fail. What happens if a
later entry in the list is a repeat of an earlier entry?
As I said in the sentence
As I said in the sentence immediately preceding that code, Of
course, this will not work for lists with duplicate entries.
Immediately following that code was a demonstration of what happens.
To put it in words, getPos() will return the only first occurrence
of the parameter supplied.
You
In some cases it's convenient to use 'repeat with anItem in aList',
to roll through the entries of a list. However, pretty often I
realize I need a counter for one reason or other, so i resort to use
'repeat with itemCounter = 1 to aList.count'.
I have often wondered if there's a hidden
At 5:08 PM +0200 9/21/02, you wrote:
In some cases it's convenient to use 'repeat with anItem in aList',
to roll through the entries of a list. However, pretty often I
realize I need a counter for one reason or other, so i resort to use
'repeat with itemCounter = 1 to aList.count'.
I have
on repeatList aList
repeat with i in aList
put aList.getPos(i)
end repeat
end
Buzz's hidden counter will work, but this one may fail. What happens
if a later entry in the list is a repeat of an earlier entry?
[To remove yourself from this list, or to change to digest mode, go to