Exercise 4.4.4: (back)
;; how-many : number number number -> number ;; Examples: (how-many 1 0 -1) -> 2 ;; Examples: (how-many 2 4 2) -> 1 ;; Examples: (how-many 3 2 1) -> 0 ;; Examples: (how-many 0 1 2) -> "degenerate" (define (how-many a b c) (cond [(= a 0) "degenerate"] [(> (square b) (* 4 a c)) 2] [(= (square b) (* 4 a c)) 1] [(< (square b) (* 4 a c)) 0])) ;; square : number -> number (define (square x) (* x x)) ;; Tests > (= (how-many 1 0 -1) 2) true > (= (how-many 2 4 2) 1) true > (= (how-many 3 2 1) 0) true