Most Effecient way to repeat a handler/function - Found word(s) list error in the Text body
Peter Haworth
pete at lcsql.com
Mon Feb 17 16:50:39 EST 2014
Have to admit I'm the same. If it's more convenient codingwise to to
repeat with x=1 to whatever and I know for sure there won;t be many
iterations to go through, the speed difference is unnoticeable to the user.
I'm also curious about another aspect of this. Is it universally true that
"repeat with" is always slower than "repeat for" or only when the loop is
addressing LC chunks of one sort or another?
Pete
lcSQL Software <http://www.lcsql.com>
Home of lcStackBrowser <http://www.lcsql.com/lcstackbrowser.html> and
SQLiteAdmin <http://www.lcsql.com/sqliteadmin.html>
On Mon, Feb 17, 2014 at 12:39 PM, Peter M. Brigham <pmbrig at gmail.com> wrote:
> On Feb 16, 2014, at 10:23 PM, Geoff Canyon wrote:
>
> > On Sun, Feb 16, 2014 at 2:52 PM, Bob Sneidar <
> bobsneidar at iotecdigital.com>wrote:
> >
> >> Funny, just before I read your post I was thinking, "I wonder if this
> >> scales linearly or logarithmically?" GET OUT OF MY HEAD!!! ;-)
> >
> > It's pretty much my personal quest to convince everyone never to use
> repeat
> > with i = 1 to the number of anything.
>
> Well, I still do it for i < 1000 or so, and the speed hit is perfectly
> acceptable for that. The advantage for me is when I must use the number of
> the iteration I'm in to do something. Sure I could do:
>
> put 0 into tCounter
> repeat for each line LL in tList
> add 1 to tCounter
> ...< do things using tCounter here>...
> end repeat
>
> but why bother for smaller sets of data?
>
> While we're dreaming of syntax extensions, how about this:
>
> repeat for each line LL in tList with counter = "tCounter"
> -- the variable tCounter would automatically be initialized then
> incremented with each iteration
> ...< do things using tCounter here>...
> end repeat
>
> -- Peter
>
> Peter M. Brigham
> pmbrig at gmail.com
> http://home.comcast.net/~pmbrig
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
More information about the use-livecode
mailing list