false and empty list
Robert E. Brown (brown@grettir.bibliotech.com)
Wed, 7 Aug 96 11:57:47 -0400
Please comment on the following solution to the problem of distinguishing
false from the empty list. There must be something I am not considering
because the solution seems quite simple.
Create a new object called #nil, which is used only when translating
non-Scheme source code into Scheme. Both false and the empty list are
converted into this new value when the source language does not distinguish
the two.
Modify eq? to return true for the following expressions:
(eq? #f #nil)
(eq? '() #nil)
In the test part of an "if" expression, #nil counts as false.
Other modifications will undoubtedly needed, but the basic idea is to treat
#nil as a synonym for both #f and '() when evaluating expressions.
bob