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

J. Landman Gay jacque at hyperactivesw.com
Mon Oct 12 23:06:48 EDT 2015


On 10/12/2015 6:24 PM, Geoff Canyon wrote:
> function greatestLessThan pList,V
>     sort items of pList descending numeric
>     sort items of pList by each >= V
>     return item 1 of pList
> end greatestLessThan

Clever. How come it works when V is in the list, when you're asking for 
">="  ? Seems like V should be toward the front of the second sort.

I used this:

   put greatestLessthan("1,2,4,5,6,8,9",5)

The 5 was at the end of the second sorted list, even though it's equal to V.

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




More information about the use-livecode mailing list