Guest User

Untitled

a guest
Jul 17th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. (defun memoize (proc)
  2. (let ((h (make-hash-table)))
  3. #'(lambda (arg)
  4. (multiple-value-bind (val present-p)
  5. (gethash arg h)
  6. (if present-p
  7. val
  8. (setf (gethash arg h) (funcall proc arg)))))))
Add Comment
Please, Sign In to add comment