Код Ревью
Сравни свои решения
#| BEGIN (Write your solution here) |#
(define (square x) (* x x))
(define (sum-of-squares x y)
(+ (square x) (square y)))
(define (max a b) (if (> a b) a b))
(define (min a b) (if (< a b) a b))
(define (solution a b c) (sum-of-squares (max (min a b) (min (max a b) c)) (max a (max b c))))
#| END |#
#| BEGIN (Write your solution here) |#
(define (square x) (* x x))
(define (sum-of-squares x y)
(+ (square x) (square y)))
(define (max x y z)
(cond ((and (>= x y) (>= x z)) x)
((and (>= y x) (>= y z)) y)
((and (>= z x) (>= z y)) z)))
(define (solution x y z)
(cond ((= (max x y z) x) (if (> y z) (sum-of-squares x y) (sum-of-squares x z)))
((= (max x y z) y) (if (> x z) (sum-of-squares y x) (sum-of-squares y z)))
((= (max x y z) z) (if (> x y) (sum-of-squares z x) (sum-of-squares z y))))
)
#| END |#
#| BEGIN (Write your solution here) |#
(define (square x) (* x x))
(define (sum-of-squares x y)
(+ (square x) (square y)))
(define (max a b) (if (> a b) a b))
(define (min a b) (if (< a b) a b))
(define (solution a b c) (sum-of-squares (max (min a b) (min (max a b) c)) (max a (max b c))))
#| END |#
#| BEGIN (Write your solution here) |#
(define (square x) (* x x))
(define (sum-of-squares x y)
(+ (square x) (square y)))
(define (max x y z)
(cond ((and (>= x y) (>= x z)) x)
((and (>= y x) (>= y z)) y)
((and (>= z x) (>= z y)) z)))
(define (solution x y z)
(cond ((= (max x y z) x) (if (> y z) (sum-of-squares x y) (sum-of-squares x z)))
((= (max x y z) y) (if (> x z) (sum-of-squares y x) (sum-of-squares y z)))
((= (max x y z) z) (if (> x y) (sum-of-squares z x) (sum-of-squares z y))))
)
#| END |#