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

append



I agree completely about your comment that the status-quo APPEND is
"wrong".  But its intent is sort of in the right direction, in the sense
that if you're not doing rplaca's or rplacd's you would like to able to
share structure with the arguments wherever possible.  The most general
way to do this might be if APPEND ignored all trailing () arguments, and
shared the last non-() argument with the result.  E.g. (APPEND A B '() '())
would return a list one of whose subtails is B.

Maybe there should be two versions?  I don't see why the last argument should
get copied unless it needs to be.  If you want to make sure the result
is newly-consed one might be required to say (COPY-APPEND ...).  I dunno.

I guess the reason things are the way they are is that I didn't feel
like thinking about it a lot when I wrote it.  The definition of APPEND
becomes more complicated anyhow when you start allowing other sequence
types, like strings, vectors, and lazy lists.  There might even be a
version of APPEND which returned a sequence which shares structure with
all the arguments, so (SET (HEAD (SHARED-APPEND A ...)) FOO) would
clobber the head of A (if A was non-empty).