Guest User

Untitled

a guest
May 19th, 2018
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scheme 0.27 KB | None | 0 0
  1. (define test '(+ (^ x 0) 5))
  2.  
  3. (define (rewrite-poly poly)
  4.   (let ((term (car poly))
  5.     (cond ((empty? poly) '())
  6.           ((and (= (car term) '^) (= (caddr term 0)))
  7.            (cons 1 (rewrite-poly (cdr poly)))
  8.           (else (cons term (rewrite-poly (cdr poly))))))
Add Comment
Please, Sign In to add comment