Code Review

Compare your solutions

    #| BEGIN (Write your solution here) |#
(define (solution x  y z)
  (+ (square 
             (largest-of-three x y z))
     (square 
             (second-of-three x y z))
  )
)

(define (largest-of-three a b c)
  (cond ((and (>= a b) (>= a c)) a)
        ((and (>= b a) (>= b c)) b)
        (else c)))

(define (second-of-three a b c)
  (cond ((and (>= a b) (>= a c)) (max b c))
        ((and (>= b a) (>= b c)) (max a c))
        (else (max a b))))

(define (square n)
  (* n n))

(define (max a b)
  (if (>= a b) a b))


#| END |#