From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Pascal J. Bourguignon" Newsgroups: gmane.emacs.help Subject: Re: Elisps rplacd vs CL's one Date: Sat, 29 Aug 2015 10:01:20 +0200 Organization: Informatimago Message-ID: <8737z2zfov.fsf@kuiper.lan.informatimago.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1440835524 14076 80.91.229.3 (29 Aug 2015 08:05:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 29 Aug 2015 08:05:24 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Aug 29 10:05:20 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZVb8Z-0006Ce-Rx for geh-help-gnu-emacs@m.gmane.org; Sat, 29 Aug 2015 10:05:20 +0200 Original-Received: from localhost ([::1]:51494 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZVb8Z-0004Lt-AB for geh-help-gnu-emacs@m.gmane.org; Sat, 29 Aug 2015 04:05:19 -0400 Original-Path: usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 52 Original-X-Trace: individual.net 2XI8oCBRzq45p871P5d/UgzO4NXn3vpFSW0QnjoE7aMLYt58Y2 Cancel-Lock: sha1:YmQzOThmMTliNDI2NGVhNGVlODBiMTQ5YmE5MDQ2NDUxMjYxY2UzYw== sha1:ZV5VprX9BqB90wr4JfblRMY1OoA= Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Original-Xref: usenet.stanford.edu gnu.emacs.help:214632 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:106916 Archived-At: Marcin Borkowski writes: > Emacs Lisp's rplacd and Common Lisp's RPLACD are called the same, but > behave differently (ELisp's one returns the NEWCDR and CL's one returns > the modified cons). What is the reason for that? Is it an accident? > While I do understand that EL ≠ CL, having a function called the same in > both, doing roughly the same thing, but not quite, seems a bit > misleading, and I was just curious whether there was a deep reason for > that. RPLACA in LISP 1.5 returned the CONS cell. Common Lisp follows suit. Notice that in CL, SETF should return the last value assigned (user defined setters could break this convention). So in CL, (setf (car x) y) returns y while (rplaca x y) returns x. On the other hand, in emacs lisp: (let ((x (cons 1 2))) (list (setf (car x) 3) (rplaca x 3))) --> (3 3) That would be the only reason I could imagine why the definition of rplaca in emacs lisp has been thus changed, probably because when emacs lisp was designed, lispers where too influenced by scheme and its bad habit of renaming classic function and being incompatible with legacy for no good reason, in general. The gotchas between emacs lisp and Common Lisp are too numerous to make a list. And imagine that before Common Lisp, you had to deal with this kind of problem about anytime you wanted to move a lisp program from one machine to the other, because each machine had its own OS, with its own specific lisp! Happily, Common Lisp came. Unfortunately RMS didn't see fit to follow the proceeding, and to upgrade emacs lisp to Common Lisp when it was finally completed. I prefer to concentrate on what's common between Common Lisp and emacs lisp: http://www.informatimago.com/develop/lisp/com/informatimago/small-cl-pgms/intersection-r5rs-common-lisp-emacs-lisp/ http://www.informatimago.com/develop/lisp/com/informatimago/small-cl-pgms/intersection-r5rs-common-lisp-emacs-lisp/intersection-cl-el-r5rs.lisp -- __Pascal Bourguignon__ http://www.informatimago.com/ “The factory of the future will have only two employees, a man and a dog. The man will be there to feed the dog. The dog will be there to keep the man from touching the equipment.” -- Carl Bass CEO Autodesk