Re: Sequence comparison

new topic     » goto parent     » topic index » view thread      » older message » newer message

Hello Michael Nelson,

These look useful but I had one question about between()

>global function less(object a,object b)
>     return compare(a,b) = -1
>end function
>
>global function greater(object a,object b)
>     return compare(a,b) = 1
>end function
>
>global function between(object a,object b,object c)
>     return compare(a,b) > -1 and compare(a,c) < 1
>end function

what if b > c? Your function wouldn't work would it?
How about this:

global function between(object a,object b,object c)
     return (compare(a,b) > -1 and compare(a,c) < 1)
            or
            (compare(a,b) < 1 and compare(a,c) > -1)
end function

just a thought,
Lewis Townsend
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu