Katia
Katia

Reputation: 729

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

Upvotes: 1

Views: 2159

Answers (2)

erjiang
erjiang

Reputation: 45727

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

Upvotes: 0

C. K. Young
C. K. Young

Reputation: 223123

Just use pair? to see if you can cdr it. There is no specific check for void, since it's essentially a phantom type.

Upvotes: 2

Related Questions