So I've been playing around with LISP lately in order to develop an appreciation for functional programming.
Now I've come into a problem I can't solve. Here is the scenario. I want to write a function that takes two lists - both lists contain words. The idea is for the function to output the list of words that appear in the first list, but don't appear in the second list.
Expected output:
(filter '(1 2 3 4 5) '(3 4))
> (1 2 5)
I've made an attempt and here's my progress so far:
Code: Select all
(defun filter (lst items-to-filter)
(cond ((null lst) nil)
((not (member (first lst) items-to-filter)) (cons (first lst) '() ) )
(t (filter (cdr lst) items-to-filter))))


