title: Append procedure in scheme
body: <p>I have been recently learning Scheme and in a tutorial i found a procedure called append</p>
  
  <pre><code>(define append
  (lambda (ls1 ls2)
  (if (null? ls1)
      ls2
      (cons (car ls1) (append (cdr ls1) ls2)))))
  </code></pre>
  
  <p>I didn't understand the logic behind this but understood that it attaches the members of the first list one by one to the second list.Can anyone explain me the last line of the procedure?
  And what does cons with the two arguments mean?</p>
  
  <p>I ran</p>
  
  <pre><code>(trace (append '( a b c) '(d e f)))
  </code></pre>
  
  <p>and ended up with</p>
  
  <pre><code>[Entering #[compound-procedure 4 append]
  Args: (a b c)
        (d e f)]
  [Entering #[compound-procedure 4 append]
  Args: (b c)
        (d e f)]
  [Entering #[compound-procedure 4 append]
  Args: (c)
        (d e f)]
  [Entering #[compound-procedure 4 append]
  Args: ()
        (d e f)]
  [(d e f)
    &lt;== #[compound-procedure 4 append]
  Args: ()
        (d e f)]
  [(c d e f)
    &lt;== #[compound-procedure 4 append]
  Args: (c)
        (d e f)]
  [(b c d e f)
    &lt;== #[compound-procedure 4 append]
  Args: (b c)
        (d e f)]
  [(a b c d e f)
    &lt;== #[compound-procedure 4 append]
  Args: (a b c)
        (d e f)]
  ;The object (a b c d e f), passed as an argument to procedure-lambda, is not a procedure.
  </code></pre>
  
  <p>It'd be gud if you explain how to read this trace results!</p>