Код Ревью
Сравни свои решения
#| BEGIN (Введите свое решение) |#
(define (square y) (* y y))
(define (fold-left op initial sequence) (define (iter result rest)
(if (null? rest)
result
(iter (op result (car rest))
(cdr rest))))
(iter initial sequence))
(define (sum-of-two-max a b c)
(define min-arg (min a b c))
(define (f x acc)
(if (> x min-arg) (+ acc (square x)) acc))
(fold-left f 0 (list a b c)))
#| END |#
#| BEGIN (Введите свое решение) |#
(define (solution a b c)
(define (square y) (* y y))
(if (< a b)
(if (< a c)
(+ (square b) (square c))
(+ (square a) (square b)))
(if (< b c)
(+ (square a) (square c))
(+ (square a) (square b)))))
#| END |#
#| BEGIN (Введите свое решение) |#
(define (square x) (* x x))
(define (sum-of-squares x y)
(+ (square x) (square y)))
(define (solution x y z) (
cond
((and (<= x y) (<= x z)) (sum-of-squares y z))
((and (<= y x) (<= y z)) (sum-of-squares x z))
(else (sum-of-squares x y))
))
#| END |#
#| BEGIN (Введите свое решение) |#
(define (square y) (* y y))
(define (fold-left op initial sequence) (define (iter result rest)
(if (null? rest)
result
(iter (op result (car rest))
(cdr rest))))
(iter initial sequence))
(define (sum-of-two-max a b c)
(define min-arg (min a b c))
(define (f x acc)
(if (> x min-arg) (+ acc (square x)) acc))
(fold-left f 0 (list a b c)))
#| END |#
#| BEGIN (Введите свое решение) |#
(define (solution a b c)
(define (square y) (* y y))
(if (< a b)
(if (< a c)
(+ (square b) (square c))
(+ (square a) (square b)))
(if (< b c)
(+ (square a) (square c))
(+ (square a) (square b)))))
#| END |#
#| BEGIN (Введите свое решение) |#
(define (square x) (* x x))
(define (sum-of-squares x y)
(+ (square x) (square y)))
(define (solution x y z) (
cond
((and (<= x y) (<= x z)) (sum-of-squares y z))
((and (<= y x) (<= y z)) (sum-of-squares x z))
(else (sum-of-squares x y))
))
#| END |#