[Top][All Lists]

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

Re: PossibleGuileBug : (eq? )

From: Neil Jerram
Subject: Re: PossibleGuileBug : (eq? )
Date: Mon, 03 Dec 2007 22:24:05 +0000
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

"address@hidden" <address@hidden> writes:

> Hello,
> Sorry if this email is a waste of your time. I think I might have encountered
> an error in guile.
> I am running guile with a very recent install for Fedora Core 8.

Thanks for your email; it certainly was not a waste of time.

> Simply put: If you ask guile to evaluate >(eq? )   i.e., absolutely nothing, 
> no
> atom, no list it returns a value of #t. [...]

The explanation for this is that Guile is providing what some people
would consider to be a natural extension to the 2-argument version of
eq?; i.e. a procedure which checks whether all of its arguments are
eq? to each other.

For why (eq?) should be true, compare `and' and `or': (and ...) is
true iff all of its arguments are true, and conventionally (and) => #t;
conversely, (or ...) is false iff all of its arguments are false, and
conventionally (or) => #f.  To my mind, (eq?) => #t is consistent with
the conventions for (and) and (or).

> If you ask it to evaluate >(eq?       ) that is followed by an arbitrary 
> number
> of empty spaces it returns a value of #t as well.
> This differs from the scheme standard and the main reason I think this is a 
> bug
> or a definitional error is that when I run the same s-expression in either
> STK scheme (that used at Berkeley or I use the PLT Scheme within the R5RS
> Language selected I get very different results.

Strictly speaking, I believe R5RS only specifies the meaning of (eq? x
y).  It does not rule out eq? with more or fewer arguments.  So I
think we could argue that Guile is still R5RS-compliant here, and has
made a different choice from STK or PLT about something that is not
specified by R5RS.

> Also when I make the same kind of bogus entry for (null?) , (null? ), (null?
>       ) in guile, guile right catches this mistake and reminds me that I have
> entered the wrong number of arguments.

In the case of null?, there isn't a similar extension or what null?
means to zero or multiple arguments.  So here Guile requires a single


reply via email to

[Prev in Thread] Current Thread [Next in Thread]