An arithmetic expression is either a number, or a three-element list
whose first and third elements are arithmetic expressions and whose middle element is one of +, -, * or /
((2+ 2) - (3 * (4* (12 / 6))))
(defun arith-eval (exp)
(labels ((legalp (exp)
(cond ((numberp exp) t)
((atom exp) nil)
(t (and (equal (length exp) 3)
(legalp (first exp))
(member (second exp)
`(+ - * /))
(legalp (third exp))))))
(arith-eval-help (exp)
(cond ((numberp exp) exp)
(t (funcall (second exp)
(arith-eval-help (first exp))
(arith-eval-help (third exp)))))))
(if (legalp exp)
(arith-eval-help exp)
`ilegal-exp)))
들여쓰기 알아보기 힘들다
글상자에 고정폭글꼴로 담아서 다시 올려주셈