title: List evaluation in LISP (strange behaviour of cons)
body: <p>I am currently playing around with LISP. Everything is fine, but I can't understand the following issue.</p>
  
  <p>I have the this append-operation:</p>
  
  <pre><code>(define (append l1 l2)
     (if (eq? l1 null)
        l2
        (cons (first l1)
              (myappend (rest l1) l2))))
  </code></pre>
  
  <p>I use it like this:</p>
  
  <pre><code>(myappend (cons (cons 1 2) null) '(4 5))
  </code></pre>
  
  <p>And the result in <a href="http://racket-lang.org/" rel="nofollow">Racket</a>  is:</p>
  
  <pre><code> '((1 . 2) 4 5)
  </code></pre>
  
  <p>But why? In my oppinion it should be <strong>'(1 2 4 5)</strong>, because cons returns a list and myappends appends two lists. Can anybody help me? What is LISP doing?</p>