(define atom?
(lambda (x)
(not (or (pair? x) (null? x)))))
(define operator car)
(define 1st-sub-exp cadr)
(define 2nd-sub-exp caddr)
(define build-aexp
(lambda (op sub1 sub2)
(cons op (cons sub1 (cons sub2 '())))))
(define numbered?
(lambda (aexp)
(cond
((atom? aexp)
(number? aexp))
(else
(and (numbered? (1st-sub-exp aexp))
(numbered? (2nd-sub-exp aexp)))))))
(define atom-to-function
(lambda (x)
(cond
((eq? x '+) +)
((eq? x '*) *)
(else expt))))
simplify which evaluates as much
of an arithmetic expression as possible. For example,
(simplify '(* 2 (+ (* a (+ 3 5)) (+ 1 4))))should return:
(* 2 (+ (* a 8) 5))
atom-to-function to include
subtraction and division.
remove-noops which elimintates
any additions of 0 or multiplications by 1. For example, both
(remove-noops '(* 3 (* 1 (+ a 0))))and
(remove-noops (simplify '(* 3 (* 1 (+ a (- 1 1))))))should return
(* 3 a).
eqv?. This is a built-in function
which works like the function eqan? defined on p. 78.
Email a .scm file containing all of your definitions (including the help functions given above) to me.