10.4.3 Racket

Racket improves on Scheme by making immutable and mutable pairs distinct types, the latter being constructed with mcons, accessed with mcar, etc. Racket also has both immutable and mutable strings, vectors, and hash tables. Bravo! But of its immutable types, only hash tables have any functional update operators; the others are merely protected from mutation.

Racket also has an equality predicate, equal-always?, that compares immutable objects of the same type by content, and mutable ones by identity, as I have argued one should. However, its use is not encouraged; the name is too long for frequent use, and the manual saysequal? is preferred for most uses”. But equal? compares mutable objects by content, as in Scheme.

What I wish here is that Racket would rename equal? to currently-equal?, then rename equal-always? to equal?. But I suppose such an incompatible change was off the table even in the early days of Racket, since it was intended to be upward-compatible with Scheme. Short of that, I think they should at least find a shorter name for equal-always?, and encourage people to use it. Coming up with a good name is not trivial, though. Maybe give a nod to Henry Baker and go with egal?.

More broadly, I think what Racket shows is that there’s more to well-designed functional collections than mere immutability. Racket takes some helpful steps in the functional-programming direction, but doesn’t fully embrace the paradigm.