title: How does "Cons" work in Lisp?
body: <p>I was studying Lisp and I am not experienced in Lisp programming. In a part of my studies I encountered the below examples:</p>
  
  <pre><code>&gt; (cons ‘a ‘(a b))  ----&gt; (A A B)
  &gt; (cons ‘(a b) ‘a)  ----&gt; ((A B).A)
  </code></pre>
  
  <p>I was wondering why when we have <strong>(cons ‘a ‘(a b))</strong> the response is <strong>(A A B)</strong> and why when we change it a little and put the <strong>'a</strong> after <strong>(a b)</strong>, the response is a dotted list like <strong>((A B).A)</strong>? What is the difference between the first code line and the second one? What is going on behind these codes?</p>