Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!edcastle!aiai!jeff From: jeff@aiai.ed.ac.uk (Jeff Dalton) Newsgroups: comp.lang.lisp Subject: Re: updating random slots in (say) defstruct Message-ID: <1569@skye.ed.ac.uk> Date: 17 Jan 90 17:47:30 GMT References: <18963@bellcore.bellcore.com> Reply-To: jeff@aiai.UUCP (Jeff Dalton) Organization: AIAI, University of Edinburgh, Scotland Lines: 17 In article <18963@bellcore.bellcore.com> pc@flash.bellcore.com writes: >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. But the system may not have defined one. Instead of having a setter function for each slot of each defstruct type, it may just have one setter function that's used for all slots and is called with an int that gives the offset of the slot in the structure. For example, > (defstruct struct a-slot) struct > (macroexpand-1 (setf (struct-a-slot x) 'z)) (system:structure-set x 0 'z) -- Jeff