I am currently playing around with LISP. Everything is fine, but I can't understand the following issue.
I have the this append-operation:
(define (append l1 l2)
(if (eq? l1 null)
l2
(cons (first l1)
(myappend (rest l1) l2))))
I use it like this:
(myappend (cons (cons 1 2) null) '(4 5))
And the result in Racket is:
'((1 . 2) 4 5)
But why? In my oppinion it should be '(1 2 4 5), because cons returns a list and myappends appends two lists. Can anybody help me? What is LISP doing?