Code Review
Compare your solutions
#| BEGIN (Введите свое решение) |#
(define (square x) (* x x))
(define (sum-of-squares x y)
(+ (square x) (square y)))
(define (find-greatest x y z)
(cond ((and (> x y) (> x z)) x)
((and (> y x) (> y z)) y)
(else z)))
(define (is-middle el f s)
(define (>= x y)
(or (> x y) (= x y)))
(define (<= x y)
(or (< x y) (= x y)))
(or (and (>= el f) (<= el s))
(and (>= el s) (<= el f))))
(define (second-greatest x y z)
(cond ((is-middle x y z) x)
((is-middle y x z) y)
((is-middle z x y) z)))
(define (solution x y z)
(define first (find-greatest x y z))
(define second (second-greatest x y z))
(sum-of-squares first second))
#| END |#
#| BEGIN (Введите свое решение) |#
(define (max a b)
(if (> a b) a b))
(define (min a b)
(if (< a b) a b))
(define (square x) (* x x))
(define (sum-of-squares x y)
(+ (square x) (square y)))
(define (solution x y z)
(sum-of-squares (max (max x y) z)
(min (max x y) z)))
#| END |#
#| BEGIN (Введите свое решение) |#
(define (square x) (* x x))
(define (sum-of-squares x y)
(+ (square x) (square y)))
(define (find-greatest x y z)
(cond ((and (> x y) (> x z)) x)
((and (> y x) (> y z)) y)
(else z)))
(define (is-middle el f s)
(define (>= x y)
(or (> x y) (= x y)))
(define (<= x y)
(or (< x y) (= x y)))
(or (and (>= el f) (<= el s))
(and (>= el s) (<= el f))))
(define (second-greatest x y z)
(cond ((is-middle x y z) x)
((is-middle y x z) y)
((is-middle z x y) z)))
(define (solution x y z)
(define first (find-greatest x y z))
(define second (second-greatest x y z))
(sum-of-squares first second))
#| END |#
#| BEGIN (Введите свое решение) |#
(define (max a b)
(if (> a b) a b))
(define (min a b)
(if (< a b) a b))
(define (square x) (* x x))
(define (sum-of-squares x y)
(+ (square x) (square y)))
(define (solution x y z)
(sum-of-squares (max (max x y) z)
(min (max x y) z)))
#| END |#