Write the function max0 : list-of-numbers -> number. It computes the maximum number in a list of numbers, assuming that all of the numbers are positive.

Solution

(define (max0 lon)
  (cond
    [(empty? lon) 0]
    [else (max-num (first lon) (max0 (rest lon)))]))

;; max-num : number number -> number
(define (max-num a b)
  (cond
    [(< a b) b]
    [else a]))

Or, if you looked ahead and are into re-use, you might have written:

(define (max0 lon)
  (cond
    [(empty? lon) 0]
    [else (max lon)]))