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: About equality in Emacs Date: Sun, 03 Feb 2013 17:22:25 +0100 Organization: Informatimago Message-ID: <878v752wqm.fsf@kuiper.lan.informatimago.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1359908713 25588 80.91.229.3 (3 Feb 2013 16:25:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 3 Feb 2013 16:25:13 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Feb 03 17:25:34 2013 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 1U22Nn-0008LY-D3 for geh-help-gnu-emacs@m.gmane.org; Sun, 03 Feb 2013 17:25:31 +0100 Original-Received: from localhost ([::1]:34861 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U22NU-00052k-Ou for geh-help-gnu-emacs@m.gmane.org; Sun, 03 Feb 2013 11:25:12 -0500 Original-Path: usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 50 Original-X-Trace: individual.net PozGsO52B1xDgXlGdl67rwOb1FvzeEOPmdOd+h+M5iHoTT5B2p8CFWJ1oA733kKCkI Cancel-Lock: sha1:NWNkMjZhMjQ2MzQ2YjUxOGJiYzFiMzZlN2VjNmYwOWI1ODczNzdiNA== sha1:YyrXxh2QSJ2kcmZN7p3GAzHG9aY= Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en Importance: high User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) Original-Xref: usenet.stanford.edu gnu.emacs.help:196636 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:88928 Archived-At: Xue Fuqiao writes: > In the trunk version of (info "(cl) Equality Predicates"): > > Also note that the Common Lisp functions `member' and `assoc' use > `eql' to compare elements, whereas Emacs Lisp follows the MacLisp > tradition and uses `equal' for these two functions. In Emacs, use > `memq' (or `cl-member') and `assq' (or `cl-assoc') to get functions > which use `eql' for comparisons. > > I'm confused with the last sentence. Don't `memq' and `assq' compare > objects with `eq'? Perhaps. But in Common Lisp, it would be EQL, since (eq 1 1) or (eq #\a #\a) can return NIL. (member 1 '(1 2 3) :test (function eq)) is not conforming in Common Lisp. In emacs lisp, the difference between eq and eql is for floating point numbers, where (eq 1.0 1.0) --> nil while (eql 1.0 1.0) --> t In emacs-version "24.2.1": (memq 1 '(1 2)) --> (1 2) (memq 1.0 '(1.0 2.0)) --> nil memq uses eq, so it's no good on floating point numbers. > Why does the manual say that they "get functions > which use `eql' for comparisons"? The sentence is: "In Emacs, use `memq' (or `cl-member') and `assq' (or `cl-assoc') to get functions which use `eql' for comparisons." The original sentence was: "In Emacs, use `member*' and `assoc*' to get functions which use `eql' for comparisons." The original meant that if you want to compare with eql, then instead of using member or assoc, you would use member* and assoc*. The new version indeed is hard to understand. Does it mean that memq and assq now use eql? I'd be surprised if it did. New emacs: Old emacs: memq assq ? eq memq assq member assoc equal member assoc cl-member cl-assoc eql member* assoc* -- __Pascal Bourguignon__ http://www.informatimago.com/ A bad day in () is better than a good day in {}.