From ... From: Erik Naggum Subject: Re: Opposite of pushnew Date: 1999/07/21 Message-ID: <3141561359871775@naggum.no>#1/1 X-Deja-AN: 503573416 References: mail-copies-to: never Organization: Naggum Software; +47 8800 8879; http://www.naggum.no Newsgroups: comp.lang.lisp * Mark Carroll | I'm looking for a sort of opposite of pushnew ... : | Is there a predefined macro I somehow missed, or a particularly nice | way of doing it? Just wondering. (-: this may be what you're looking for. please note that neither preparing derivative works or making modifications are permitted by default. (this is not free software in case that isn't obvious.) (defmacro drop (object place &rest keys &key key test test-not &environment environment) "Drop a particular OBJECT from list in PLACE. (Intended as counterpart to PUSH/-NEW.) Copyright 1999 by Erik Naggum. Verbatim inclusion and redistribution permitted. For any other use, write or call +47 8800 8879 or +1 510 435 8604." (declare (ignore key test test-not)) (multiple-value-bind (vars vals store-vars writer reader) (get-setf-expansion place environment) (let ((evaled-value (gensym)) (store-var (first store-vars))) (if (cdr store-vars) `(let* ((,evaled-value ,object) ,@(mapcar #'list vars vals)) (multiple-value-bind ,store-vars ,reader (setq ,store-var (delete ,evaled-value ,store-var :count 1 ,@keys)) ,writer)) `(let* ((,evaled-value ,object) ,@(mapcar #'list vars vals) (,store-var (delete ,evaled-value ,reader :count 1 ,@keys))) ,writer))))) #:Erik -- @1999-07-22T00:37:33Z -- pi billion seconds since the turn of the century