function for greatest object in list less than or equal to a value

J. Landman Gay jacque at hyperactivesw.com
Mon Oct 12 00:06:46 EDT 2015


On 10/11/2015 9:26 PM, dunbarx at aol.com wrote:
> function findItemLessThanIndex tData,tIndex
>     put comma & tIndex after tData
>     sort items of tData numeric
>     return  item itemOffset("5",tData) -1 of tData
> end findItemLessThanIndex

I thought of that too, but it fails if tIndex isn't in the list. The 
example list was: "1,3,4,7,9" and the target limit was 5.

I couldn't see a way that avoids looping through all the values.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list