(defun memoize (fn-name &key (key #'first) (test #'eql)) (setf (symbol-function fn-name) (memo (symbol-function fn-name) fn-name key test)))