I am trying to write a function that takes two inputs X and L, the second one of which is a list, the first one may or may not be a list.
The function will then search L and take out THE FIRST APPEARANCE of X in L, and will return the rest of L untouched.
I wrote what I thought (after a series of revisions) was a correct solution to this simple problem:
The function will then search L and take out THE FIRST APPEARANCE of X in L, and will return the rest of L untouched.
I wrote what I thought (after a series of revisions) was a correct solution to this simple problem:
(defun takeoutFirst(X L)
(cond
((null L) nil)
((null X) L)
((equal X (car L)) (cdr L))
(t (append (car L) (takeoutFirst X (cdr L))))))
The compiler's (GLC 2.6.6) only output is "Broken at IF".