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

From: Shiro Kawai <shiro>
Date: Tue Oct 3 01:05:10 2006

From: dyb_at_cs.indiana.edu
Subject: Re: [r6rs-discuss] [Formal] Requirement to detect circular lists
Date: Mon, 02 Oct 2006 23:12:48 -0400

> Shiro Kawai <shiro_at_lava.net> wrote:
> > According to the note on 'map' in section 23.3.1, page 124
> > must the r6rs compliant system raise an exception in the
> > following code?
> >
> > (let ((x (list 1 2)))
> > (set-cdr! (cdr x) x) ;; x = #0=(1 2 . #0#)
> > (map f some-list x))
> >
> > This may be a kluge, but sometimes it is handy and I'd miss it
> > if R6RS won't allow it.
>
> I may be misinterpreting what you mean by "miss it", but this example
> isn't valid in R5RS, so it's not something that used to be portable but no
> longer is. In fact, it now has a portable semantics (though probably not
> the one you want), where it had none before.

You're right about portability, but that's not what I'm talking about.
What I miss is that, with R5RS, standard-compliant implementation
can still have this kind of extention, while with R6RS it would not.

I think the spirit of R6RS is that, if one wants such an extension,
an implementation should have two modes (or two libraries),
r6rs-compliant mode and extension mode, and only raise an
exception in r6rs-compliant mode. I understand the importance
of portable semantics. Yet a question remains: what do we gain
by limiting the domain of 'map' to plausible lists of length-n,
instead of explicitly allowing circular lists and/or lists of
different lengths (e.g. plausible lists up to n).

--shiro
Received on Tue Oct 03 2006 - 01:06:26 UTC

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