Re: lingo-l Just out of curiosity (repeat loop)
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 yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
Re: lingo-l Just out of curiosity (repeat loop)
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 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. Following that was a hidden counter snippet that works just as Buzz's does, though it was initiated as 1 and incremented at the end of the repeat rather than at the start. He beat me by two minutes. -- Mark A. Boyd Keep-On-Learnin' :) [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
Re: lingo-l Just out of curiosity (repeat loop)
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 know Malk, I could do with reading things more carefully! (ps. the Malk part was a joke) [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
lingo-l Just out of curiosity (repeat loop)
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 counter somewhere that Director uses when counting throough the items using 'repeat with anItem in aList'? If so, can I check the value of that counter and use it? No big deal, just curious. -A. [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
Re: lingo-l Just out of curiosity (repeat loop)
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 often wondered if there's a hidden counter somewhere that Director uses when counting throough the items using 'repeat with anItem in aList'? If so, can I check the value of that counter and use it? No big deal, just curious. yes, there's a hidden counter. if you want it, create it! hiddenCounter = 0 repeat with anItem in aList hiddenCounter = hiddenCounter + 1 put hiddenCounter end hth -Buzz -A. [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!] [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
Re: lingo-l Just out of curiosity (repeat loop)
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 http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]