Yeah, kinda makes sense that it would work that way. Grab the data from the container once, do magic things behind the scenes to get it ready to go, then loop through the lines. I guess it could work either way though, where it uses byte offsets to get the next chunk, which would have made the function method really suck for large data sets.
Now I'm curious.. what exactly does repeat for each do? Split on cr, sort the keys and increment each loop to pop out the right line from the array? Store all the data in a temp variable and read each line (item, char) by start/end position? On Sun, Apr 5, 2015 at 4:19 PM, Jerry Jensen <j...@jhj.com> wrote: > Hi Mike, > > > On Apr 5, 2015, at 12:31 PM, Mike Bonner <bonnm...@gmail.com> wrote: > > > > While not exactly whats been requested, this works pretty well: > > > > repeat for each line tLine in (myFilter(sData,"abc*","with")) > > > > I like the way a where clause reads as in the OP, but being able to use > an > > inline function for data generation is rather powerful, and if all you > need > > is a filter, setting up a function to do so is pretty straight forward. > > Good trick! I didn't know you could do that either. > > I wondered if the function was called just once, or on every repeat. Your > exapmle wouldn't tell, because the function would return the same stuff > every time. > > So I tested it. The answer is that the function is called only once. Good! > > global gCount > > on mouseUp > global gCount > put 0 into gCount > repeat for each line L in mylines() > put L & cr after msg > end repeat > put gCount after msg -- how many times mulines() was called > end mouseUp" > > function mylines > global gCount > add 1 to gCount > return "1" & cr & "2" & cr & "3" & cr > end mylines > > > > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode > _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode