intersection of two lists
Posted: Wed Aug 01, 2012 8:29 am
Hi,
I'm trying to write a recursive function returning the intersection of two given lists... I can't figure out why I'm getting the
error message: void function. I'd be grateful for help!
I'm trying to write a recursive function returning the intersection of two given lists... I can't figure out why I'm getting the
error message: void function. I'd be grateful for help!
Code: Select all
(defun intersect(A B)
(if (eq A ())
A
(if (member (car A) B)
(push (car A) (intersect(cdr A) B))
(intersect(cdr A) B))))
(intersect'(1 2 3 4) '(0 1 2))