***** 練習1の解答 ***** (define apple 110) (define orange 90) (define pineapple 230) (define peech 190) (define melon 800) (define box 50) (define giftbox (+ (* melon 1) (* apple 5) (* orange 3) box)) (define specialbox (+ (* (* peech 0.9) 3) pineapple (* (* orange 0.8) 5))) ***** 練習2の解答 ***** (define f (lambda (x) (+ (* x x) (* 5 x) 6))) (define g (lambda (x) (* (+ x 2) (+ x 3)))) (define d (lambda (a b c) (- (* b b) (* 4 a c)))) (define s (lambda (a b t) (* 1/2 a b (sin (/ (* pi t) 180))))) (define heron1 (lambda (a b c s) (sqrt (* s (- s a) (- s b) (- s c))))) (define heron (lambda (a b c) (heron1 a b c (/ (+ a b c) 2)))) ※ heron が heron1 を呼び出すインタフェースになっている. - このような書き方は,後で学ぶ Prolog ではよく使われる.