Reputation: 63
(define (member atom list)
(cond
((null? list) '())
(= atom (car list) "True")
(else
(member atom(cdr list)))
)
)
(member '5 '(1 2 3 4 5))
Always it gives true even though that atom isn't a member in the list. Could you plz help me to clarify this question as soon as possible.
Upvotes: 0
Views: 243
Reputation: 27184
The second clause of cond
should be:
((= atom (car list)) "True")
Upvotes: 2