; Problem: Define (between a b c) that holds if b is between
;   a and c.

(define between-1
  (lambda (a b c)
    (cond
      ((and (< a b) (< b c)) #t)
      ((and (> a b) (> b c)) #t)
      ((and (< a b) (> b c)) #f)
      ((and (> a b) (< b c)) #f)
      ((= a b) #f)
      ((= b c) #f)
      (else #f))))

; Holly's question: "Do we really need all of this?  If
; neither of the first two tests hold, can't we be assured
; that b is not between a and c?"
(define between-2
  (lambda (a b c)
    (cond
      ((and (< a b) (< b c)) #t)
      ((and (> a b) (> b c)) #t)
      (else #f))))

(define between-3
  (lambda (a b c)
    (cond
      ((< a b c) #t)
      ((> a b c) #t)
      (else #f))))

; In English: b is between a and c if either
;   (1) a, b, and c are in strictly increasing order
; OR
;   (2) a, b, and c are in strictly decreasing order
(define between
  (lambda (a b c)
    (or (< a b c)
        (> a b c))))