Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!magnus.ircc.ohio-state.edu!murthy From: murthy@magnus.ircc.ohio-state.edu (Murthy S Gandikota) Newsgroups: comp.lang.lisp Subject: Question about INTERN Message-ID: <1991Jan29.055536.1523@magnus.ircc.ohio-state.edu> Date: 29 Jan 91 05:55:36 GMT Sender: news@magnus.ircc.ohio-state.edu Organization: The Ohio State University Lines: 47 Originator: murthy@right.magnus.ircc.ohio-state.edu Nntp-Posting-Host: right.magnus.ircc.ohio-state.edu consider the following lisp definitions: (defstruct house rooms area) (setf my-house (make-house :rooms 4 :area 100)) (setf any-house my-house) (defun get-slot-value (obj slot) ;;this function returns the value of the slot in obj (PROG (obj1 value) (setf obj1 obj) (if (equal (type-of obj) 'symbol) (setf obj1 (eval obj))) (setf value (eval `(,(intern (format nil "~a-~a" (type-of obj1) slot)) ,obj))) (RETURN value))) (defun put-slot-value (obj slot value) ;;this function over writes the value of a slot (PROG (obj1) (setf obj1 obj) (if (equal (type-of obj) 'symbol) (setf obj1 (eval obj))) (eval `(setf (,(intern (format nil "~a-~a" (type-of obj1)) slot)) ,obj) ',value)))) (get-slot-value any-house 'rooms) returns 4 whereas (get-slot-value my-house 'rooms) causes error put-slot-value also behaves similarly These functions used to work all right on Symbolics lisp. The errors only happen on Vax lisp 3.x! Can anyone point out the reason? Or, point out other efficient ways to implement such functions? Thanks Murthy Gandikota