I’m new to scheme and I’m trying to do a small very straight forward program.
But I keep getting this error message “Syntactic keyword may not be used as an expression: if”.
Can anyone tell me if I’m missing something in my program or if I’m doing some sort of mistake?
Here is my program.
(define (foo lis k)
(COND
((NULL? lis) '())
(IF (< (CAR lis) k)
(display (CAR lis))
ELSE (display (CDR lis)))
))
(foo '(1 5 3 2 4) 3)
Thanks
-Gunnlaugur
I’m not sure what you are trying to do, but it seems like if is not needed there: