Scheme: How to Check If Void

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

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

Chloe Bennett

Chloe Bennett

Culture, Media & Entertainment Columnist

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.

Share this article
Twitter Facebook Pinterest