Next: , Previous: , Up: srfi comparators   [Index]


2.38.15 Interval (ternary) comparison predicates

These procedures return #t or #f depending on whether an object is contained in an open, closed, or half–open interval. All comparisons are done in the sense of comparator, which is default-comparator if omitted.

Function: in-open-interval? obj1 obj2 obj3
Function: in-open-interval? comparator obj1 obj2 obj3

Return #t if obj1 is less than obj2, which is less than obj3; otherwise return #f.

Usage examples:

(import (vicare) (srfi :114))

(define-constant C fixnum-comparator)

(in-open-interval? 1 2 3)       ⇒ #t
(in-open-interval? 1 1 3)       ⇒ #f
(in-open-interval? 1 3 3)       ⇒ #f

(in-open-interval? 1 0 3)       ⇒ #f
(in-open-interval? 1 0 3)       ⇒ #f
(in-open-interval? 1 0 3)       ⇒ #f

(in-open-interval? 1 9 3)       ⇒ #f
(in-open-interval? 1 9 3)       ⇒ #f
(in-open-interval? 1 9 3)       ⇒ #f

(in-open-interval? C 1 2 3)     ⇒ #t
(in-open-interval? C 1 1 3)     ⇒ #f
(in-open-interval? C 1 3 3)     ⇒ #f

(in-open-interval? C 1 0 3)     ⇒ #f
(in-open-interval? C 1 0 3)     ⇒ #f
(in-open-interval? C 1 0 3)     ⇒ #f

(in-open-interval? C 1 9 3)     ⇒ #f
(in-open-interval? C 1 9 3)     ⇒ #f
(in-open-interval? C 1 9 3)     ⇒ #f
Function: in-closed-interval? obj1 obj2 obj3
Function: in-closed-interval? comparator obj1 obj2 obj3

Return #t if obj1 is less than or equal to obj2, which is less than or equal to obj3; otherwise return #f.

Usage examples:

(import (vicare) (srfi :114))

(define-constant C fixnum-comparator)

(in-closed-interval? 1 2 3)     ⇒ #t
(in-closed-interval? 1 1 3)     ⇒ #t
(in-closed-interval? 1 3 3)     ⇒ #t

(in-closed-interval? 1 0 3)     ⇒ #f
(in-closed-interval? 1 0 3)     ⇒ #f
(in-closed-interval? 1 0 3)     ⇒ #f

(in-closed-interval? 1 9 3)     ⇒ #f
(in-closed-interval? 1 9 3)     ⇒ #f
(in-closed-interval? 1 9 3)     ⇒ #f

(in-closed-interval? C 1 2 3)   ⇒ #t
(in-closed-interval? C 1 1 3)   ⇒ #t
(in-closed-interval? C 1 3 3)   ⇒ #t

(in-closed-interval? C 1 0 3)   ⇒ #f
(in-closed-interval? C 1 0 3)   ⇒ #f
(in-closed-interval? C 1 0 3)   ⇒ #f

(in-closed-interval? C 1 9 3)   ⇒ #f
(in-closed-interval? C 1 9 3)   ⇒ #f
(in-closed-interval? C 1 9 3)   ⇒ #f
Function: in-open-closed-interval? obj1 obj2 obj3
Function: in-open-closed-interval? comparator obj1 obj2 obj3

Return #t if obj1 is less than obj2, which is less than or equal to obj3; otherwise return #f.

Usage examples:

(import (vicare) (srfi :114))

(define-constant C fixnum-comparator)

(in-open-closed-interval? 1 2 3)        ⇒ #t
(in-open-closed-interval? 1 1 3)        ⇒ #f
(in-open-closed-interval? 1 3 3)        ⇒ #t

(in-open-closed-interval? 1 0 3)        ⇒ #f
(in-open-closed-interval? 1 0 3)        ⇒ #f
(in-open-closed-interval? 1 0 3)        ⇒ #f

(in-open-closed-interval? 1 9 3)        ⇒ #f
(in-open-closed-interval? 1 9 3)        ⇒ #f
(in-open-closed-interval? 1 9 3)        ⇒ #f

(in-open-closed-interval? C 1 2 3)      ⇒ #t
(in-open-closed-interval? C 1 1 3)      ⇒ #f
(in-open-closed-interval? C 1 3 3)      ⇒ #t

(in-open-closed-interval? C 1 0 3)      ⇒ #f
(in-open-closed-interval? C 1 0 3)      ⇒ #f
(in-open-closed-interval? C 1 0 3)      ⇒ #f

(in-open-closed-interval? C 1 9 3)      ⇒ #f
(in-open-closed-interval? C 1 9 3)      ⇒ #f
(in-open-closed-interval? C 1 9 3)      ⇒ #f
Function: in-closed-open-interval? obj1 obj2 obj3
Function: in-closed-open-interval? comparator obj1 obj2 obj3

Return #t if obj1 is less than or equal to obj2, which is less than obj3; otherwise return #f.

Usage examples:

(import (vicare) (srfi :114))

(define-constant C fixnum-comparator)

(in-closed-open-interval? 1 2 3)        ⇒ #t
(in-closed-open-interval? 1 1 3)        ⇒ #t
(in-closed-open-interval? 1 3 3)        ⇒ #f

(in-closed-open-interval? 1 0 3)        ⇒ #f
(in-closed-open-interval? 1 0 3)        ⇒ #f
(in-closed-open-interval? 1 0 3)        ⇒ #f

(in-closed-open-interval? 1 9 3)        ⇒ #f
(in-closed-open-interval? 1 9 3)        ⇒ #f
(in-closed-open-interval? 1 9 3)        ⇒ #f

(in-closed-open-interval? C 1 2 3)      ⇒ #t
(in-closed-open-interval? C 1 1 3)      ⇒ #t
(in-closed-open-interval? C 1 3 3)      ⇒ #f

(in-closed-open-interval? C 1 0 3)      ⇒ #f
(in-closed-open-interval? C 1 0 3)      ⇒ #f
(in-closed-open-interval? C 1 0 3)      ⇒ #f

(in-closed-open-interval? C 1 9 3)      ⇒ #f
(in-closed-open-interval? C 1 9 3)      ⇒ #f
(in-closed-open-interval? C 1 9 3)      ⇒ #f

Next: , Previous: , Up: srfi comparators   [Index]