30 Dec
2011
30 Dec
'11
5:41 p.m.
On 21 December 2011 20:30, Ryan Davis <ryan@acceleration.net> wrote:
I'm using a hash-table as a cache, and had a problem with ensure-gethash. Some example code / output:
I must be missing something. Why the CONSTANTP and LAMBDA instead of (defmacro ensure-gethash (key hash-table &optional default) "Like GETHASH, but if KEY is not found in the HASH-TABLE saves the DEFAULT under key before returning it. Secondary return value is true if key was already in the table." `(multiple-value-bind (value ok) (gethash ,key ,hash-table) (if ok (values value ok) (values (setf (gethash ,key ,hash-table) ,default) nil)))) ? Cheers, -- nikodemus