title: Adding to the end of list in LISP
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/6439972/what-is-the-cons-to-add-an-item-to-the-end-of-the-list">what is the ‘cons’ to add an item to the end of the list?</a>  </p>
  </blockquote>
  
  
  
  <p>After watching many tutorials on lisp and searching high and low on google for answers, I still cannot figure out how to add to the end of a list in LISP. </p>
  
  <p>I want my function to add <code>'a</code> at the end of the list <code>'(b c d)</code> but I only know how to add it in front. Can someone help me use cons correctly to add <code>'a</code> at the end of the list? Here is my code. Thanks in advance.</p>
  
  <pre><code>(defun AddRt (a list)
    (cond
      ((null list)
        0)
      (t
        (princ (cons a (cons (car list) (cdr list))))
      )))
  
  
  (AddRt 'a '(b c d))
  </code></pre>