Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!forsight!gat From: gat@forsight.jpl.nasa.gov (Erann Gat) Newsgroups: comp.lang.lisp Subject: Re: (setf (values ... Message-ID: <1991Jun13.232739.24568@elroy.jpl.nasa.gov> Date: 13 Jun 91 23:27:39 GMT References: <1991Jun13.204847.5625@jpl-devvax.jpl.nasa.gov> Sender: news@elroy.jpl.nasa.gov (Usenet) Organization: Jet Propulsion Laboratory Lines: 16 Nntp-Posting-Host: robotics.jpl.nasa.gov In article <1991Jun13.204847.5625@jpl-devvax.jpl.nasa.gov> charest@AI-Cyclops.JPL.NASA.GOV writes: >Anyone out there have CL code for a setf method for values as mentioned on page 129 of CLtL2? The code should handle the case wherein any of the sub-forms of values can themselves have setf methods. Thanks in advance. Well, if you really must do such a hideous thing: (defmacro setf-values (&rest args) (let ( (locations (butlast args)) (form (car (last args))) ) (let ( (temps (mapcar #'(lambda (s) (gensym "TEMP")) locations)) ) `(multiple-value-bind ,temps ,form ,@(mapcar #'(lambda (loc new-loc) `(setf ,loc ,new-loc)) locations temps))))) (defsetf values setf-values) E.