10.4.2 Scheme (R6RS)

R6RS Scheme has mutable hash tables and ... that seems to be it.

Well, wait: there’s a little more to be said. Strings are immutable. Functional point update operations are not provided, presumably out of time complexity concerns, but string-append and substring are provided, and there are functions to convert to and from lists of characters; I guess the idea is that fine-grained string construction will be done using lists and then converted. Amusingly, there’s string-copy, though it’s hard to see why one would ever use it.

On first reading, it appears that pairs, and therefore lists, are immutable, so that lists are indeed a functional type. That would be great — but then one reads farther and finds the mutable-pairs library, which brings in set-car! and set-cdr!, which operate on the same pair type. So you can’t absolutely count on your lists not getting mutated (unless they’re constants in the source code; those are required to be protected).

… Aaaand it turns out there’s a mutable-strings library as well. Again, there’s only one string type; loading this library doesn’t define a new type, but causes the existing one to become mutable. (And again, an exception is made for string constants in source code.) At least now we can see a use for string-copy.

Like CL, Scheme has a “deep equality” predicate equal?. This is very similar to CL’s equal, except that it compares vectors by content, even though they’re mutable.