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

Re: A Proposal!!



In article <uvqitw7jsyw.fsf@ernie.ai.mit.edu>, gregs@ai.mit.edu (Gregory
T. Sullivan) wrote:

> Why not say that all !'ed versions _must_ maintain eq?-ness and all
> non-!'ed versions _never_ side-effect the existing object?  

Because that's silly.

How are you going to do that with a list?  The efficient thing to do with
a list is to create a cons cell, put the new data in it, point it at the
existing list, and return the new cell.  The only way to make it == the
existing list would be to traverse the list down to the end and add the
new element there.  Or at least add it as the second element.

Making add! return an == thing on a non-stretchy vector is plain impossible.


The way it is now is fine and comes from a long history of LISP
programing.  Wihtout ! is pure functional -- doens't affect the arguments
-- and with ! is allowed to do whatever it wants with whatever is fastest
being king.

-- Bruce



Follow-Ups: References: