Article View: gnu.emacs.bug
Article #724Re: append bug
From: Barry Margolin
Date: Sat, 29 Aug 1992 00:12
Date: Sat, 29 Aug 1992 00:12
21 lines
1445 bytes
1445 bytes
In article <9208261449.AA02643@uiucmath.math.uiuc.edu> dan@math.uiuc.edu writes:
> (append "aaaa" "bbbb" "cccc")
> (97 97 97 97 98 98 98 98 . "cccc")
>I don't know whether it is the documentation which is wrong or the code.
Hard to say. The behavior is undoubtedly due to its Maclisp heritage. In
Maclisp, append only worked on lists, and was not allowed to copy the last
list. So (append l1 l2) is equivalent to (nconc (copy-list l1) l2). Note
in particular that the last argument to nconc need not be a list; the last
cdr of the penultimate argument is set the last argument. The same thing
happens in append: A list containing the elements of all but the last
argument is constructed, and the last cdr of this is set to the last
argument.
With Emacs Lisp's extension of append to strings and vectors, it's not
clear what the right thing is.
--
Barry Margolin
System Manager, Thinking Machines Corp.
barmar@think.com {uunet,harvard}!think!barmar
Technical Details
Message-ID:
<17mfe8INNlcn@early-bird.think.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!think.com!barmarReferences:
<9208261449.AA02643@uiucmath.math.uiuc.edu>Show Full Headers
Complete Article Headers
Newsgroups: gnu.emacs.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!think.com!barmar From: barmar@think.com (Barry Margolin) Subject: Re: append bug Message-ID: <17mfe8INNlcn@early-bird.think.com> Sender: gnulists@ai.mit.edu Organization: Thinking Machines Corporation, Cambridge MA, USA References: <9208261449.AA02643@uiucmath.math.uiuc.edu> Distribution: gnu Date: Sat, 29 Aug 1992 00:12:56 GMT Approved: bug-gnu-emacs@prep.ai.mit.edu Lines: 22