You're missing a set of parentheses. You're also missing a test for the recursion bottoming out.
(define test
(lambda (x)
(cond ((eq? x '()) '())
((= 0 (modulo (car x) 2))
(cons (car x) (test(cdr x))))
(else (test(cdr x))))
))
The general syntax of cond
is:
(cond (<test1> <result1>)
(<test2> <result2>)
...)
In your code <test1>
was simply =
, not (= 0 (modulo (car x) 2))
.