From: Ramakrishnan Muthukrishnan Date: Thu, 23 Dec 2010 13:55:31 +0000 (+0530) Subject: solution to 2.87 X-Git-Url: https://git.rkrishnan.org/frontends/class-simplejson.JSONEncoder-index.html?a=commitdiff_plain;h=14e7098332d03c1bf462b810589cd75579b9803b;p=sicp.git solution to 2.87 --- diff --git a/src/sicp/ex2_87.rkt b/src/sicp/ex2_87.rkt new file mode 100644 index 0000000..5f503f5 --- /dev/null +++ b/src/sicp/ex2_87.rkt @@ -0,0 +1,16 @@ +#lang racket + +(put '=zero? '(polynomial) + (lambda (p) + (define (terms-=zero? terms) + (if (empty-termlist? terms) + #t + (let ((term (first-term terms))) + (let ((c (coeff term))) + (let ((type (type-tag c))) + (let ((zproc (get '=zero? (list type)))) + (if (zproc c) + (terms-=zero? (rest-terms terms)) + #f))))))) + + (terms-=zero? (term-list p)))) \ No newline at end of file