chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] R6RS immutable pair


From: John Cowan
Subject: Re: [Chicken-users] R6RS immutable pair
Date: Wed, 12 Jul 2006 17:42:48 -0400
User-agent: Mutt/1.3.28i

Kon Lovett scripsit:

> Anybody want to way in on the proposed immutability of pairs? FWIW, I  
> am ambivalent. My gut says NO but my heart says yes. This is the most  
> serious suggested change, IMHO. It doesn't just "break some existing  
> programs", it breaks with 50 years of lisp tradition.
> 
> In Chicken 'set-c*r' is a common operator. Should pairs be immutable  
> something must replace them. I don't buy the suggestion of records or  
> vectors as a replacement, too heavy.

I'd like to see the existing pairs left alone, and new immutable pairs
without identity added.  That is, (immutable-cons 1 2) is permitted (but
not required) to return the same pair (in the sense of EQ?) every time
it's called.

All existing procedures would continue to work with immutable pairs
except, of course, SET-CAR! and SET-CDR!.  Some decision would have to
be taken about procedures like APPEND that accept multiple arguments:
my initial take is that they should produce immutable results unless
all the arguments are mutable.

Scheme would need new procedures MUTABLE-PAIR?, IMMUTABLE-PAIR?,
IMMUTABLE-CONS, IMMUTABLE-LIST, MUTABLE->IMMUTABLE, and
IMMUTABLE->MUTABLE.

-- 
John Cowan   address@hidden    http://ccil.org/~cowan
Original line from The Warrior's Apprentice by Lois McMaster Bujold:
"Only on Barrayar would pulling a loaded needler start a stampede toward one."
English-to-Russian-to-English mangling thereof: "Only on Barrayar you risk to
lose support instead of finding it when you threat with the charged weapon."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]