Scheme: how to check if void
Emily Wong
I get this error :
cdr: expects argument of type <pair>; given #<void>and checking if (null? argument) isn't working
I searched alot for void? function , but I could find anything
so , any ideas ppl :)
thanks a million in advance
2 Answers
Just use pair? to see if you can cdr it. There is no specific check for void, since it's essentially a phantom type.
Chris's answer is good because you really want to be checking for a pair to cdr, but for future reference, you may be able to do (eq? (void) (void)) if (void) is available or (eq? (if #f #t) (if #f #t)) if you want to define your own (void).