title: LISP "Error Illegal function object..."
body: <p>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.</p>
  
  <p>So here is my code so far:</p>
  
  <pre><code>(defun union2 (l1 l2)
    (cond ((null l1) l2)
          ((member((car l1) l2)) (union2((cdr l1) l2)))
          (t (cons (car l1) (union2((cdr l1) l2)))))
    )
  </code></pre>
  
  <p>When I try to run my test:</p>
  
  <pre><code>(union2 '(5 7 2 3 1) '(3 2 4 6 9))
  </code></pre>
  
  <p>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.</p>