[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: () as an expression



In article <1990Jan16.193134.10491@sun.soe.clarkson.edu> jk0@sun.soe.clarkson.edu (Jason Coughlin) writes:
>The Revised^3 Report says that () is an illegal expression.  It must
>be quoted.  However, MIT-Scheme and PC-Scheme both allow it, ie:
...
>Why is () an invalid expression?  It seems to me that it is a constant.
>
>(eq? #t #t) => #t
>(eq? #f #f) => #t
>(eq? '() '()) => #t
>
>now why isn't () considered a constant, when it really IS a constant?

The syntax () is considered a combination (a.k.a. procedure call) and
as such must have at lease one subexpression.  So, the empty list is
valid, but the empty combination is an error.

Note also that #f and '() may be distinct in newer Scheme
implementations [the value of (eq? '() #f) is currently unspecified]. 

There are other non-R^3RS behaviors allowed by various versions of
Scheme implementations, particularly those implementations done before
R^3RS was issued.

-Ken Dickey