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

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Tue Oct 3 06:58:06 EDT 2006


Abdulaziz Ghuloum <aghuloum at cs.indiana.edu> writes:

> set-car! and set-cdr! are a thing from the past and I sure hope that
> R6RS is the last Scheme standard to support them.  The benefits from
> dropping mutable pairs far outweigh the alleged benefits of making
> map, length, and friends accept circular lists.  Just my opinion.

I agree.

It makes sense for eqv? on immutable pairs to compare their contents.
Which means that mutable and immutable pairs are conceptually different
types, rather than different subsets of operations on the same type.

What about improper lists? They are unfortunately used by Scheme
source syntax. But IMHO the concept of an immutable proper list is a
nice model of a finite sequence, and a list which is not necessarily
proper is an ugly artifact of an implementation where it's simpler
for cons to not look inside the second argument.

Proper lists lead to simpler or more consistent error checking.
With improper lists code like this:
   (apply (lambda ys ys) xs)
either needs to traverse xs or might miss an error.

BTW, is this code allowed to return xs, or does it have to copy it?
With immutable lists this would not matter.

-- 
   __("<         Marcin Kowalczyk
   \__/       qrczak at knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/



More information about the r6rs-discuss mailing list