Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!cs.utexas.edu!rutgers!bellcore!pc@flash.bellcore.com From: pc@flash.bellcore.com Newsgroups: comp.lang.lisp Subject: updating random slots in (say) defstruct Message-ID: <18963@bellcore.bellcore.com> Date: 15 Jan 90 15:49:10 GMT Sender: news@bellcore.bellcore.com Reply-To: pc@flash.bellcore.com Organization: Bellcore Lines: 27 > In article <18837@bellcore.bellcore.com> pc@flash.bellcore.com writes: > >There appears to be no Common LISP way to similarly update a random > >slot. The best one can do seems to be: > > You can do > > (setq updater-function #'(lambda (object value) > (setf (test-one object) value))) > > (funcall updater-function instance value) > Yes, that's so. But given a defstruct with 50 slots, i must define an updator function for each, which seems wasteful, given that the DEFSTRUCT has already defined one. > In ANSI Common Lisp you'll be able to use #'(setf test-one) to access the > updater function directly. Ah, now this is closer to what i was looking for. But what i want to do, is define a SETFable function created with (INTERN (string-append "-" )). Perhaps i really have to throw the whole expression i've consed up to EVAL. But that really is a bit gross. Peter Clitherow