Hi, I appreciate those who replied. Jackie, you've been a big help since HC days many years ago. Thanks again for this suggestion. I have worked with arrays a little, but it hadn't occurred to me in this case. The key was:
(theRangeArray[i] <> empty) I hadn't made that connection and its one I'll try to remember. I modified the script to fit my needs and it runs great. Thanks Ron PS the speed is quite acceptable, credit the engine again. > > On Wednesday, January 29, 2003, at 04:57 AM, Ron wrote: >> >> I have 2 lists. I need to check whether the values of list 2 fall >> within the >> range of the values of list 1. eg. >> >> list 1 >> 1 10 >> 20 25 >> 45 55 >> >> list 2 >> 1,3,12,23,34,45,52,78 > > Arrays are very fast. I didn't benchmark it, but see if something like > this is faster than what you are using now: > > function checkRanges > put fld 1 into theRanges -- this is List 1 > repeat for each line l in theRanges -- make an array > put word 1 of l + 1 into theStart > put word 2 of l - 1 into theStop > repeat until theStart > theStop > put theStart into theRangeArray[theStart] > add 1 to theStart > end repeat > end repeat > -- now check the items in list 2 against the array: > put fld 2 into theList > repeat for each item i in theList > put (theRangeArray[i] <> empty) & comma after theResults > end repeat > return theResults > end checkRanges > > This returns a list of booleans corresponding to each item in List 2, > indicating whether each item is within range or not. > > Creating the initial array probably takes the most time (but it is still > very fast.) If this is something you will use repeatedly, build the > array only once and store it in a global variable so you don't have to > rebuild it each time you want to use it. > > -- > Jacqueline Landman Gay | [EMAIL PROTECTED] > HyperActive Software | http://www.hyperactivesw.com _______________________________________________ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
