(wat-aro)

生きてます

SICP 問題1.3

1.3 三つの数を引数としてとり,大きい二つの数の事情の話を返す手続きを書け
 
答えはa2 + b2, b2 + c2, c2 + a2の3通りがあるのでその分け方をもとに書く

(define (sum-of-squares-large2 a b c)
  (cond ((or (<= a b c) (<= a c b))
         (sum-of-squares b c))
        ((or (<= b a c) (<= b c a))
         (sum-of-squares a c))
        (else (sum-of-squares a c))))