Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

Scheme: how to check if void

Writer 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

1

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).

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy