Write a function that accepts an exp and produces a number by evaluating the exp.

Solution

;; eval : paren-less-exp -> number
(define (eval exp)
  (cond
    [(number? exp) exp]
    [(op? exp) ((op-fun exp)
                (eval (op-left exp))
                (eval (op-right exp)))]))