solutions/Structure and Interpretatio.../sicp-ex-1.3.rkt

11 lines
337 B
Racket
Executable File

(define (square x) (* x x))
(define (sum-of-squares x y) (+ (square x) (square y)))
(define (is-first-least? a b c) (and (< a b) (< a c)))
(define a 9)
(define b 1)
(define c 10)
(cond ((is-first-least? c a b)(sum-of-squares a b))
((is-first-least? a c b)(sum-of-squares c b))
((is-first-least? b a c)(sum-of-squares a c)))