Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!purdue!bu-cs!dartvax!ai.etl.army.mil!hoey From: hoey@ai.etl.army.mil (Dan Hoey) Newsgroups: comp.lang.lisp Subject: Re: Are "destructive" functions really destructive? Message-ID: <372@ai.etl.army.mil> Date: 29 Nov 89 20:50:30 GMT References: <20991@mimsy.umd.edu> <1989Nov29.173139.26165@Neon.Stanford.EDU> <1989Nov29.114923.1843@hellgate.utah.edu> Reply-To: hoey@ai.etl.army.mil (Dan Hoey) Organization: Naval Research Lab, Washington, DC Lines: 22 In article <1989Nov29.114923.1843@hellgate.utah.edu> moore%cdr.utah.edu@cs.utah.edu (Tim Moore) writes: ... >If delete's behavior really bothers you, you can construct a deletef >macro like: > >(defmacro deletef (item place) > `(setf ,place (delete ,item ,place))) > >Obviously this isn't completely equivalent to delete; caveat emptor Perhaps something more like (defmacro deletef (item place &rest delete-options &aux (itemv (gensym))) (multiple-value-bind (vars vals store store-form access-form) (get-setf-method place) `(let* ((,itemv ,item) ,.(mapcar #'list vars vals) (,(car store) (delete ,itemv ,access-form ,@delete-options))) ,store-form ,(car store)))) Dan