简体   繁体   中英

How do I initialize a variable as null in R5RS?

While working on a project in Dr. Scheme, I initialized a variable as null as follows:

(define var null)

How can I do this in R5RS?

In Scheme, the conventional placeholder for "invalid" is #f , the false object. You can test for it using not .

(There is a null? procedure in Scheme that checks whether the object is the empty list, () . However, that should only be used for list contexts, and not as an "invalid" placeholder. Note that not only returns true for #f , and null? only returns true for () ; be careful not to mix the two up.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM