Re: Cycle detection problems: #442, #338, "equal?" John Cowan (30 Aug 2012 06:43 UTC)
Re: [Scheme-reports] Cycle detection problems: #442, #338, "equal?" Per Bothner (30 Aug 2012 17:08 UTC)
Re: [Scheme-reports] Cycle detection problems: #442, #338, "equal?" Pierpaolo Bernardi (31 Aug 2012 12:03 UTC)

Re: [Scheme-reports] Cycle detection problems: #442, #338, "equal?" Per Bothner 30 Aug 2012 17:05 UTC

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@bothner.com   http://per.bothner.com/

_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports