[r6rs-discuss] [Formal] Requirement to detect circular lists
shiro at lava.net
Tue Oct 3 01:06:26 EDT 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).
More information about the r6rs-discuss