function for greatest object in list less than or equal to a value
dunbarx at aol.com
dunbarx at aol.com
Mon Oct 12 09:35:04 EDT 2015
Jacque,
My gadget adds the index in a parameter to the function. if it already exists in the list, the addition is superfluous, but harmless.
Craig
-----Original Message-----
From: J. Landman Gay <jacque at hyperactivesw.com>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Mon, Oct 12, 2015 12:07 am
Subject: Re: function for greatest object in list less than or equal to a value
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
_______________________________________________
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