I am writing a Scheme function that detects if a word is in a list of words. My code uses an if statement and memq to return either #t or #f. However, something is causing the f
Parentheses matter:
(define in? (lambda (y xs) (if (memq y xs) #t #f)))
so
if
memq
BTW, you can also express this as
(define in? (lambda (y xs) (and (memq y xs) #t)))