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

From: Marcin 'Qrczak' Kowalczyk <qrczak>
Date: Tue Oct 3 06:58:22 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/
Received on Tue Oct 03 2006 - 06:58:06 UTC

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