Immutable things.

Chris Bitmead uid(x22068) Chris.Bitmead@Alcatel.com.au
Tue, 13 May 1997 10:42:38 +1000


>> I think all this talk of deciding which functions do and don't return
>> immutable things is foolish. What are you going to do? Have a
>> map-car-immutable which returns an immutable list and map-car-mutable
>> which returns a mutable one? Are you going to double up on every
>> function in Scheme or CL?
>
>mapcar could easily be polymorphic -- if it is given a mutable list, it
>returns a mutable list, while if it is given an immutable list, it returns
>an immutable list.

Who said that if you pass an immutable list you want to get back a
mutable one? Who said if you pass a mutable one you want to get back
an immutable one? I don't see the relationship. map-car was only an
example anyway. You could apply the same question to functions which
return non-list structures.

>Pray tell; exactly how many times do you want mapcar to return a
>mutable list under _any_ conditions?

Well, doesn't CL have a destructive reverse function (reverse or
nreverse). Are you saying I shouldn't use it? Are you saying you want
to break existing code that uses it?

>I'd be very interested in how many times in high quality Lisp
>programming mutable lists are _ever_ used.  (Besides my 'Shallow
>Binding' paper ;-) The 'Reduce' people told me that they initially
>used rplaca/d all over the place, and were pleasantly surprised that,
>when they got rid of them in order to make the system more
>maintainable, it actually got _faster_, as well, although that wasn't
>the goal of the project.

I like functional. I program functionally. I don't change lists.

The question is, do we really want to re-invent Lisp? Doesn't this
project have enough on it's plate without introducing this question?