Brennan <[EMAIL PROTECTED]> wrote: > I discovered this curiosity; > > b = [1,256,999] > sort b > put b.findposNear(1000) > -- 4
Hi Brennan, findPosNear() has always worked this way, at least since Director 5. I suppose that the name "findPosNear" was chosen instead of the more accurate "findPosIdenticalOrNext" in order to go easy on our typing fingers. I find the function most useful for dealing with alphabetical lists and auto-completion widgets. I often use a combination of findPos() and findPosNear(). If findPos(x) returns 0 then I use findPosNear(x) - 1. I do not consider this to be a bug or even a quirk. If findPosNear() were to round to the nearest value, you would have to check if the nearest value were higher or lower than the value expected, which would give you the same result but would probably take more clock cycles. The current implementation is simple and logical. What behavior do you expect from findPosNear()? Cheers, James [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]) Lingo-L is for learning and helping with programming Lingo. Thanks!]
