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

Re: [Scheme-reports] Cycle detection problems: #442, #338, "equal?"

On 08/30/2012 05:51 AM, David A. Wheeler wrote:
> John Cowan:
>> Note that having a portable implementation of R7RS `equal?` is not an
>> issue, as all implementations are expected to provide it.  They may also
>> (as Chibi does) also provide the R5RS `equal?` function in a different library.
> Okay.  I still think it's important that the spec clearly state what happens if a cycle is detected by "equal?".  I recommend text like "If a cycle is detected, #f is returned."  I'm guessing that's what many implementations with cycle-detection do (is that true?).

No, that would be wrong if both operands have "equivalent" cycles.

   (equal? '#1=(x . #1#) '#2=(x x . #2#))

This must return #t *if* it returns without an error.
An implementation might be allowed to *not* return
(loop indefinitely or throw an exception), but not to return #f
in this case.

If equals? terminates, it must return the correct result.
	--Per Bothner
per@x   http://per.bothner.com/

Scheme-reports mailing list