On Sun, Sep 22, 2013 at 9:53 AM, Pascal Costanza <p...@p-cos.net> wrote: > (defmacro assure (type form) > (let ((object (copy-symbol 'object))) > `(let ((,object ,form)) > (check-type ,object ,type) > ,object))) > If Alexandria doesn't want it, the problem is that there doesn't seem to be any widespread enough library for general utilities that moves at decent speed http://xkcd.com/927/
> (defmacro assocf (item alist &optional default &rest keys &key test test-not > key) > (declare (ignore test test-not key)) > (let ((it (copy-symbol 'it)) (cons (copy-symbol 'cons))) > `(let* ((,it ,item) (,cons (assoc ,it ,alist ,@keys))) > (unless ,cons > (setf ,cons (cons ,it ,default) > ,alist (cons ,cons ,alist))) > ,cons))) > This implementation loses badly if the alist form has side-effects. That where you'd use the long form of define-modify-macro. Also, assocf is a slightly confusing name considering what you usually expect from define-modify-macro. —♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org You think you know when you can learn, are more sure when you can write, even more when you can teach, but certain when you can program. — Alan Perlis