Some things never change

Mike Taylor is having a bad initial experience with Scheme. In particular:

As I continue to work my way through the exercises (using Scheme itself at least for now), I run into a problem: for exercise 2.9.3 I need set-car!, which the purity-fascist maintainers of PLT Scheme removed in release 4.0. No doubt there is a secret incantation to undo this change, but I can’t immediately see what it is.

As he has already figured out, this is because he's using an R5RS book with an R6RS-ish implementation, and R6RS DrScheme's dialect is not a superset of R5RS — not even of the commonly taught parts of R5RS. Such conspicuous backward incompatibilities occasionally strike other languages (Perl, certainly, and hasn't it happened to Python at some point?) but it's more embarrassing in a language like Scheme, which is supposed to be old and elegant and stable.

Correction: as Eli Barzilay points out, it's supposed to be an R6RS book. The use of set-c*r! without the necessary (import (rnrs mutable-pairs)) is probably an oversight, made easy by the fact that it still works in most R6RS implementations. So part of the problem here is that the book is buggy: it uses features that aren't in the language it's teaching. Also, DrScheme's main language isn't R6RS but a different dialect which also happens to lack set-car!.

It's also unfortunate in a language which already has a reputation for being impractical. Mike correctly attributed the problem to “purity-fascist maintainers”, but how many other students, on seeing that Scheme's most popular educational implementation doesn't (by default) support the examples used in popular tutorials, have concluded (or confirmed their prejudice) that Lisp is not useful outside of the ivory tower?

(I don't particularly mind immutable lists, but they're a strange thing to break backward compatibility over.)


  1. PLT supports multiple Lispy languages. The confusion that follows is this one of its most frequently criticized aspects of PLT Scheme.

    To your point it defaults to '#lang scheme', but not R6RS though.

  2. 1. See the comment I had left on his blog; as he discovered later, he doesn't have a problem if he uses the right language in plt.
    2. Did you actually see the book he uses -- it *is* an "r6rs book".

  3. Oh, so the book claims to be an R6RS book but actually uses some non-R6RS features. (I updated the original post.)

    Multiple languages are like configuration options: in theory they let everyone have what they want, but they're useless to newbies, because they don't know what the options mean. How is a beginning Schemer supposed to know, by chapter 2 of an introductory textbook, that their implementation has multiple languages, let alone that the default doesn't support the language used in the textbook?

    Of course, this wouldn't be a problem for an R6RS book that stuck to R6RS features. But it still breaks compatibility with the many R5RS tutorials.

  4. set-c*r! are part of R6RS though; like you said they are in the mutable-pairs library.

  5. I would expect a beginning Schemer to ask for help if something didn't make sense.

  6. Correction: they'll know languages exist, because DrScheme complains loudly until they choose one. (Although when they select Choose Language in DrScheme 4.2.5, the list includes neither r6rs nor anything that looks like the default, so I'm not sure what they're supposed to do there.)

  7. set-c*r! are in the library, but not necessarily in the default namespace. A simple import would fix that, but the book doesn't cover libraries (or, AFAICT, any non-R5RS features) until chapter 3.

  8. In the case of PLT, newbies should at least read some of the docs, which describe languages like r6rs.


It's OK to comment on old posts.