Write a procedure called direct-num-occurs
? that checks whether a number occurs in a list of numbers. Examples:
> (direct-num-occurs? 1 '(2 3 1 4))
;=> #t
> (direct-num-occurs? 1 '(2 3 5 4))
;=> #f
This is what I tried:
(define direct-num-occurs?
(lambda (num ws)
(cond
[(null? ws) #f]
[(equal? num (car ws)) #t]
[else (direct-num-occurs? (cdr ws) num)])))
But I'm getting an error that says expected a pair.