; evaluate post fix notation from page 185 of Cooke (defun ev(X S); X is the expression and S is the stack (cond ((null X) S); when expression is empty return the stack ((integerp (car X)) (ev (cdr X) (push(car X) S)) ) (t (ev (cdr X) (push (eval (list (car X) (top(pop S)) (top S))) (pop(pop S)) );/push );/ev );/t );/cond ) ; stack operations (defun push(X S) (cons X S)) (defun pop(S) (if (null S) NIL (cdr S))) (defun top(S) (if (null S) NIL (car S))) ; testing (trace ev) (print '(ev '(1 2 + 3 *) NIL)) (print (ev '(1 2 + 3 *) NIL))