[r6rs-discuss] [Formal] Requirement to detect circular lists -
shiro at lava.net
Wed Oct 4 19:34:09 EDT 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-
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.
More information about the r6rs-discuss