I just started learning lisp in my class. I'm doing a homework assignment in which I have to program a few very basic functions using some primitives operations such as car, cdr, cons, append, reverse, atom, eq, equal, and null.
So here is my code so far:
(defun union2 (l1 l2)
(cond ((null l1) l2)
((member((car l1) l2)) (union2((cdr l1) l2)))
(t (cons (car l1) (union2((cdr l1) l2)))))
)
When I try to run my test:
(union2 '(5 7 2 3 1) '(3 2 4 6 9))
I get an "Error: Illegal function object: (car l1)." I was under the impression that I was writing the code correctly. What am I doing wrong? Thank you for your time.