Code Review
Compare your solutions
#| BEGIN (Введите свое решение) |#
#lang sicp
(#%require rackunit)
(define (sqrt x) (* x x))
(define (sqrt-sum x y) (+ (sqrt x) (sqrt y)))
(define (least-of x y z)
(cond [(and (> x z) (> y z)) z]
[(and (> x y) (> z y)) y]
[(and (> y x) (> z x)) x]
[else x]))
(define (solution a b c)
(cond [(= (least-of a b c) c) (sqrt-sum a b)]
[(= (least-of a b c) b) (sqrt-sum a c)]
[(= (least-of a b c) a) (sqrt-sum b c)]
[else -1]
))
#| END |#
#| BEGIN (Введите свое решение) |#
(define (sqrt x) (* x x))
(define (sqrt-sum x y) (+ (sqrt x) (sqrt y)))
(define (least-of x y z)
(cond [(and (> x z) (> y z)) z]
[(and (> x y) (> z y)) y]
[(and (> y x) (> z x)) x]
[else x]))
(define (solution a b c)
(cond [(= (least-of a b c) c) (sqrt-sum a b)]
[(= (least-of a b c) b) (sqrt-sum a c)]
[(= (least-of a b c) a) (sqrt-sum b c)]
[else -1]
))
#| END |#
#| BEGIN (Введите свое решение) |#
#lang sicp
(#%require rackunit)
(define (sqrt x) (* x x))
(define (sqrt-sum x y) (+ (sqrt x) (sqrt y)))
(define (least-of x y z)
(cond [(and (> x z) (> y z)) z]
[(and (> x y) (> z y)) y]
[(and (> y x) (> z x)) x]
[else x]))
(define (solution a b c)
(cond [(= (least-of a b c) c) (sqrt-sum a b)]
[(= (least-of a b c) b) (sqrt-sum a c)]
[(= (least-of a b c) a) (sqrt-sum b c)]
[else -1]
))
#| END |#
#| BEGIN (Введите свое решение) |#
(define (sqrt x) (* x x))
(define (sqrt-sum x y) (+ (sqrt x) (sqrt y)))
(define (least-of x y z)
(cond [(and (> x z) (> y z)) z]
[(and (> x y) (> z y)) y]
[(and (> y x) (> z x)) x]
[else x]))
(define (solution a b c)
(cond [(= (least-of a b c) c) (sqrt-sum a b)]
[(= (least-of a b c) b) (sqrt-sum a c)]
[(= (least-of a b c) a) (sqrt-sum b c)]
[else -1]
))
#| END |#