From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: 7 logical-xor implementations in source tree Date: Tue, 23 Jul 2019 10:48:23 -0700 Organization: UCLA Computer Science Department Message-ID: References: <87tvbd9a8p.fsf@oremacs.com> <86wog9gn5n.fsf@gmail.com> <7AAB8009-DD68-4EA7-93CC-3B4A89FC8AFD@acm.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="115126"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 Cc: Andy Moreton , Emacs Development To: =?UTF-8?Q?Mattias_Engdeg=c3=a5rd?= , Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 23 19:48:40 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hpytz-000Tm6-Lv for ged-emacs-devel@m.gmane.org; Tue, 23 Jul 2019 19:48:39 +0200 Original-Received: from localhost ([::1]:46378 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hpyty-00017K-2e for ged-emacs-devel@m.gmane.org; Tue, 23 Jul 2019 13:48:38 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57548) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hpytp-00014W-9c for Emacs-devel@gnu.org; Tue, 23 Jul 2019 13:48:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hpyto-0007EE-DT for Emacs-devel@gnu.org; Tue, 23 Jul 2019 13:48:29 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:60394) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hpyto-0007CU-8Z for Emacs-devel@gnu.org; Tue, 23 Jul 2019 13:48:28 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id B82651626E5; Tue, 23 Jul 2019 10:48:24 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id zZjCcEA95fRj; Tue, 23 Jul 2019 10:48:24 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 115D31626F2; Tue, 23 Jul 2019 10:48:24 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 7-dpQAs2wfwb; Tue, 23 Jul 2019 10:48:23 -0700 (PDT) Original-Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com [23.242.74.103]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id DA7ED1626E5; Tue, 23 Jul 2019 10:48:23 -0700 (PDT) In-Reply-To: Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 131.179.128.68 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:238854 Archived-At: Mattias Engdeg=C3=A5rd wrote: > I would probably use the negation, boolean equivalence, more often than= xor myself. Me too. This was also Dijkstra's opinion (I attended an infamous lecture = by him=20 on the subject). > define-inline in particular will produce decent code. I don't think performance is much of a concern here, and would favor defi= ning=20 them as functions instead; that's simpler and allows them to be used in m= ore=20 contexts when code is written using a functional style. > +(defmacro equiv (&rest args) > + "Boolean equivalence: t if arguments are all non-nil or all nil." When equiv has one or more arguments and they are all non-nil, it might b= e more=20 useful for equiv to return its last argument instead of returning t. Of c= ourse=20 I'm bike-shedding here....