<< Previous exercise (2.87) | Index | Next exercise (2.89) >>

I didn't follow the book's suggestion and implemented the sub procedure by adding the terms of the first polynomial to the multiplication of all terms of the second by -1 or -1x^0.

```
(define (sub-poly p1 p2)
(if (same-variable? (variable p1) (variable p2))
(make-poly (variable p1)
(add-terms (term-list p1)
(mul-term-by-all-terms (make-term 0 -1)
(term-list p2))))
(error "Polys not in same var -- SUB-POLY"
(list p1 p2))))
```

hi-artem

`(define (negate-terms termlist) (map (lambda (t)(make-term(order t) (- (coeff t)))) termlist))`

CrazyAlvaro

Sphinxsky

I think hi-artem is wrong and meterogan is right. Because MAP only works on lists, it is impossible to achieve Abstract masking if MAP is used.However, there are also errors in meterogan's writing.It should look like this：