Guest User

Untitled

a guest
May 16th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scheme 0.61 KB | None | 0 0
  1. (define (make-term coeff exp)
  2.   (cons coeff exp))
  3.  
  4. (define (term-coeff term) (car term))
  5. (defien (term-exp term) (cdr term))
  6.  
  7. (define (make-polynomial variable . terms)
  8.   (list variable terms)
  9.   (define (poly-variable poly)
  10.     (list-ref poly 0))
  11.   (define (poly-exponent poly)
  12.     (list-ref poly 1))
  13.     (begin
  14.       (display "variable is: ")
  15.       (display variable)
  16.       (newline)
  17.       (display "the terms are: ")
  18.       (display "(")
  19.       (display (poly-variable terms))
  20.       (display variable)
  21.       (display "^")
  22.       (display (poly-exponent terms))
  23.       (display ")")
  24.       (newline)))
Add Comment
Please, Sign In to add comment