(defun print-object-readably (object) (let ((slots (map 'list #'c2mop:slot-definition-name (c2mop:class-slots (class-of object)))) (class (class-name (class-of object)))) (cons class (remove-if #'null (loop for slot in slots collect (if (slot-boundp object slot) (cons slot (slot-value object slot)))))))) (defun read-object (sexp) (let* ((class (car sexp)) (object (make-instance class))) (loop for slot in (cdr sexp) do (setf (slot-value object (car slot)) (cdr slot))) object))