Just a quick note about SICP, mutable pairs, and PLTScheme

I was going through exercises in Section 3.3 of SICP recently (Modeling with Mutable Data), and discovered that my version of PLTScheme (4.1.4) does not include set-car! and set-cdr! operators. It turns out the team that maintains this development environment (now called “Racket”) changed this in Version 4. Originally Scheme had mutable pairs by default. So when you used cons, it created a mutable pair, though it treated it as immutable if you used car and cdr on it. You had to use set-car! and set-cdr! to change a pair’s contents. The dev. team changed PLTScheme such that cons creates immutable pairs (and car and cdr operate on it in an immutable fashion as usual). To use mutable pairs you need to use mcons, mcar, and mcdr to do the same operations that you used cons, car, and cdr to carry out on immutable pairs. Where the SICP text says to use set-car!, and set-cdr!, to manipulate mutable pairs, you need to use set-mcar!, and set-mcdr!.

This change only applies to the issue of immutable vs. mutable pairs. The dev. team made this decision, because in their view it made Scheme more of a pure functional language. However, I noticed that the set! operator (which changes a binding) still exists and works as expected in my copy of PLTScheme.

Edit: I goofed a bit when I posted this earlier today. I said that PLTScheme users should use mcar and mcdr to carry out the same operations as set-car! and set-cdr! in the SICP text. That is not the case. People should use set-mcar! and set-mcdr! for those operations.

An example of computing as a new medium

Bret Victor, a former designer at Apple, is working on a way to use a computer to make math more meaningful. I can see that he really gets the representational aspect, that the symbols are not the math, just a way to represent it, and it’s not a particularly good way to represent it. This is not the whole of math encapsulated into something that’s easy to understand (math is about assertions and inferences of relationships, which are then proved or disproved), but it’s an alternative to using symbols for representing complex relationships.

Here’s an article talking about Bret’s work on an early version of something he’s working on for the iPad.

Great stuff, and I congratulate him on finding a good use for a computer!