;; Should test for "is in hash table", rather than NIL-ness (defmacro defmemo (name lambda-list &rest body) (let ((memo (make-hash-table :test #'equal)) (tmp (gensym))) `(flet ((,tmp ,lambda-list ,@body)) (defun ,name (&rest args) (or (gethash args, memo) (setf (gethash args ,memo) (apply #',tmp args)))))))