title: Print defstruct in Lisp
body: <p>I have a very simple data structure that I have defined in Lisp:</p>
  
  <pre><code>;;Data structure for a person
  
  (defstruct person
    (name nil)
    (age 0)
    (siblings nil :type list))   ;; Siblings is a list of person objects
  </code></pre>
  
  <p>I then procede to instantiate a few person objects:</p>
  
  <pre><code>(setf person-a (make-person :name 'Tim :age 23))
  (setf person-b (make-person :name 'Sally :age 21))
  (setf person-c (make-person :name 'Louis :age 24))
  </code></pre>
  
  <p>I then relate the siblings (assume they are all siblings of each other):</p>
  
  <pre><code>(setf (person-siblings person-a) (list person-b person-c))
  (setf (person-siblings person-b) (list person-a person-c))
  (setf (person-siblings person-c) (list person-b person-a))
  </code></pre>
  
  <p>How can I then print information about the objects that i've instantiated and modified?  I have looked into the options of a defstruct with regard to print-object and print-function but I cannot figure out how to properly print my objects.  Using something like:</p>
  
  <pre><code>(print person-a)
  </code></pre>
  
  <p>sends my ACL interpreter into an infinite loop.</p>