乐正

Actions speak louder than words.

Sicp-ex2-87

问题

请在通用算数包中为多项式安装=zero?,这样使adjoin-term也能对系数本身是多项式的 多项式使用。

解答

1
2
3
4
5
6
7
8
9
10
(define (install-polynomial-package)
  ;; ... 省略

  (define (=zero? term)
    (= (coeff term) 0))

  (put '=zero? 'polynomial
       (lambda (term) (tag (=zero? term))))

  'done)

draft

« sicp-ex2-86 sicp-ex2-88 »

Comments