[plt-scheme] The historical role/value of set-car! and set-cdr!

From: Bill Wood (william.wood3 at comcast.net)
Date: Sat Jan 26 20:05:21 EST 2008

On Sat, 2008-01-26 at 17:32 -0600, Grant Rettke wrote:
> Tonight I went through some problems involving set-car! and set-cdr!.
> Other than the homework problems, I have yet hear of folks
> recommending using these functions.
> I re-read this article:
> http://blog.plt-scheme.org/2007/11/getting-rid-of-set-car-and-set-cdr.html
> to get a sense of where they fit today.
> Historically, though, they must have been there for some really good reason?
> What was that reason?

I think early on the developers of lisp and other list-manipulation
languages believed that it was necessary to bring out facilities for the
explicit manipulation of list structure to the programmer.  In the LISP
1.5 Programmer's Manual, 1962, p. 41 McCarhy et.al. say in part

   ... Although this language is universal in terms of computable
   functions of symbolic expressions, it is not convenient as a
   programming system without additional tools to increase its power.
   In particular, elementary LISP has no ability to modify list
   ... LISP is made general in terms of list structure by means of the
   basic list operators "rplaca" and "rplacd". ...

The Scheme procedures set-car! and set-cdr! correspond to, respectively,
rplaca and rplacd.

I know when I first learned lisp I got the sense that there were two
distinct levels of view of the language, one as a language for
expressing recursive functions over a symbolic domain and the other as a
language for manipulating singly-linked lists.  The latter view pretty
much requires cons, car, cdr, set-car! and set-cdr!

Recent discussions about making cons cells immutable seem to point
toward a bifurcation of this two-level view into two distinct
programming systems; the question of whether this bifurcation is a Good
Thing lies at the heart of the discussion.

Posted on the users mailing list.