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

From: Shiro Kawai <shiro>
Date: Wed Oct 4 19:32:57 2006

From: Paul Schlie <schlie_at_comcast.net>
Subject: [r6rs-discuss] [Formal] Requirement to detect circular lists - benchmarks
Date: Wed, 04 Oct 2006 19:08:23 -0400

>
> William D Clinger wrote:
> > That trick is one of the reasons set-car! and set-cdr!
> > are not part of the (r6rs) library. Programs should
> > not have to pay for mutable pairs unless they use them.
> >
> > The higher-order procedures can't use the above trick,
> > however, because the draft R6RS says they must raise
> > an exception for things like ...
>
> or of course alternatively, R6RS may drop the requirement
> that certain functions be restricted to utilizing proper
> lists; thereby enabling set-car! and set-cdr! to be brought
> back into the baseline scheme standard without incurring
> the overhead otherwise implied;
>
> and instead define an optionally supported implementation
> library enabling the declaration of arguments and objects as
> being immutable (constant) and/or proper, and corresponding
> alternative definition of functions such as set-xxx!, ... which
> may then enforce and/or leverage this knowledge in conjunction
> with a compiler as may be desired without otherwise unnecessarily
> incompatibly modifying the language.

I personally don't mind the incompatibility from the previous
language if the change makes the language better.

But I still don't undertand why dropping mutable pairs are
so strongly associated with the requirement of plausible
lists on some procedures... As I mentioned, if mutable pairs
go away (and no other primitives in standard to generate circular
lists), the standard wouldn't need to care about circular lists
anymore, and the standard-comforming 'map' can happily accept
circular lists or lists of diferent lengths as an implementation-
specific extension.

In such implementation, if a programmer wants to make sure passed
lists are proper lists of same lengths, she can write a check
easily. I used to think one advantage of current requirement
was that 'map' and alike could check argument vailidity along
applying the passed procedure on elements, so it could avoid
two-pass check cost, but Mr. Clinger has explained it's not the case.

--shiro
Received on Wed Oct 04 2006 - 19:34:09 UTC

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