So If I have a defclass object and I make an instance of it and place it inside an array. How do I get the value of its slots inside the array?
I've tried:
(slot-value (aref *array* 0) :name)
I guess I am just not understanding how to access an object that is inside an array.
I can print the object in an unreadable form using (format t) but is there a way to print an object and all the slots in a form I can actually understand?
(defun generate-object (name)
(let ((a (make-instance 'person
:name name)))
(setf (aref *array* 0) a)))
it places the object inside the array but it seems that the slot is not being created?
This causes the problem:
(defclass person ()
((name :accessor name
:reader read-name
:initarg :name)))
(defvar *array* 0)
(setf *array* (make-array 20))
(defun generate-object (name)
(let ((a (make-instance 'person
:name name)))
(setf (aref *array* 0) a)))