[plt-scheme] caution about use of 'pair?' in programs with mutable pairs?

From: Henk Boom (lunarc.lists at gmail.com)
Date: Mon Jan 14 20:43:55 EST 2008

On 14/01/2008, Marco Morazan <morazanm at gmail.com> wrote:
> What are the semantics of mcar & mcdr? Since car & cdr are observers,
> why do we need to differentiate them from mcar & mcdr? On the same
> note, why does pair? return false on an mpair?

A pair is immutable. Functions consuming them can therefore assume
that they will not change. If I understand correctly, the whole reason
for immutable pairs is that functions consuming them can avoid making
all sorts of checks for when the lists change. pair? recognizing
mpairs would break this.

Don't have a clue about the reasons for mcar and mcdr though.

    Henk Boom

Posted on the users mailing list.