I'm writing a function that returns elements which appear in one list and not in another. For example,
(except '(a b c) '(a d b e f))
will return '(c)
. The first argument can be an atom, and both are assumed to be flat. Here's my code:
(define (except lm ln)
(cond ((null? ln) lm)
((not (list? lm))
(cond ((in? lm ln) '())
(#t lm)))
((null? lm) '())
((in? (car lm) ln) (except (cdr lm) ln))
(#t (cons (car lm) (except (cdr lm) ln)))))
Then an error returns saying "except: misuse of unit import keyword in: (except (cdr lm) ln)".
Why this is happening?