Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;;; Make a new term where the coeffecient is x
- ;;; and the power to which its being raised is y
- (define (make-term x y)
- (list x y))
- ;;; Gives the coefficient of a term
- (define (coefficient t)
- (list-ref t 0))
- ;;; Gives the power to which the term is being raised
- (define (power t)
- (list-ref t 1))
- ;;; Prints the term in the form:
- ;;; coefficient x variable ^ power
- (define (print-term t)
- (begin
- (display (coefficient t))
- (display "x")
- (display "^")
- (display (power t))))
Add Comment
Please, Sign In to add comment