S.I/Lisp/

The =BETWEEN?() function




ABSTRACT

The =BETWEEN?([number_to_check], [lower_bound], [upper_bound]) function returns TRUE if the number_to_check is between the given lower_bound and upper_bound (inclusive) and FALSE if the number_to_check is either above the upper_bound or below the lower_bound.


(Use the BETWIXT? function to exclude the boundaries)




EXAMPLE

=BETWEEN?(10, 5, 15)
-> TRUE

=BETWEEN?(10, 10, 15)
-> TRUE

=BETWEEN?(10, 12, 15)
-> FALSE
        



SOURCE CODE

DEFINE(
    BETWEEN?,
    LAMBDA(
        number_to_check,
        lower_bound,
        upper_bound,
        AND(
            GTE?(
                number_to_check,
                lower_bound),
            LTE?(
                number_to_check,
                upper_bound))))
        



Help us optimize this function!