Expression Trees to English [file expenglish.lsp]
(defun op (x) (first x))
(defun lhs (x) (second x))
(defun rhs (x) (third x))
(defun op->english (op)
(list 'the
(second (assoc op '((+ sum)
(- difference)
(* product)
(/ quotient)
(sin sine)
(cos cosine)))) 'of))
(defun exp->english (x)
(if (consp x) ; operator?
(append
(op->english (op x))
(exp->english (lhs x))
(if (null (cddr x)) ; unary?
'()
(cons 'and
(exp->english (rhs x)) ) ) )
(list x) ) ) ; leaf: operand