[r6rs-discuss] [Formal] Requirement to detect circular lists

From: William D Clinger <will>
Date: Tue Oct 3 21:50:34 2006

I am posting this as an individual member of the Scheme
community. I am not speaking for the R6RS editors, and
this message should not be confused with the editors'
eventual formal response.

Andre van Tonder wrote:
> I think the arguments must be checked up front for all the higher order
> procedures. This seems to be required by the "must" in sentences to the
> effect:
>
> "an exception must be raised if list is not a plausible list"
>
> in the notes to length and map, which I assume must apply to all these
> procedures. So an exception has to be raised in this case, right?

Yes. For a simpler example, consider

    (let ((circular (list 0)))
      (set-cdr! circular circular)
      (for-each (lambda (x)
                  ((lambda (f) (f f))
                   (lambda (f) (f f))))
                circular))

The draft R6RS clearly states that the for-each procedure
must raise an exception for the above example. Please
note that I am not endorsing this detail of the draft
R6RS.

Will
Received on Tue Oct 03 2006 - 21:50:30 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC