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

11 lines
337 B
Racket
Raw Permalink Normal View History

2024-04-16 19:13:00 -04:00
(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)))