Exercise 4.2.1: (back)

1. the interval (3,7]:

;; is-between-3-excl-7-incl? : number -> number ;; to determine whether n is between 3 (exclusive) ;; and 7 (inclusive) (define (is-between-3-excl-7-incl? n) (and (< 3 n) (<= n 7)))

2. the interval [3,7]:

;; is-between-3-incl-7-incl? : number -> number ;; to determine whether n is between 3 (inclusive) ;; and 7 (inclusive) (define (is-between-3-incl-7-incl? n) (and (>= n 3) (<= n 7)))

3. the interval [3,7):

;; is-between-3-incl-9-excl? : number -> number ;; to determine whether n is between 3 (inclusive) ;; and 9 (exclusive) (define (is-between-3-incl-9-excl? n) (and (>= n 3) (< n 9)))

4. the union of (1,3) and (9,11):

;; is-between-1-3-or-9-11? : number -> number ;; to determine whether n is between 1 and 3 (exclusive) ;; or 9 and 11 (exclusive) (define (is-between-1-3-or-9-11? n) (or (and (< 0 n) (< n 4)) (and (< 8 n) (< n 12)) ))

5. and the range of numbers outside of [1,3]:

;; is-under-1-or-over-3? : number -> number ;; to determine whether n less than 1 (inclusive) ;; and greater than 3 (inclusive) (define (is-under-1-or-over-3? n) (or (<= n 1) (>= n 3)))