From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: "Basil L. Contovounesios" Newsgroups: gmane.emacs.devel Subject: Re: Predicate for true lists Date: Tue, 09 Apr 2019 13:51:53 +0100 Message-ID: <87a7gz8hp2.fsf@tcd.ie> References: <87fu3vdjjk.fsf@tcd.ie> <87bmcqhhsf.fsf@tcd.ie> <87in6xgtpb.fsf@tcd.ie> <2af892df-26cb-60b2-4fd8-067fcb3d32e9@cs.ucla.edu> <87r2kh9uwx.fsf@tcd.ie> <83h8lcnbxb.fsf@gnu.org> <87sh4s9poo.fsf@tcd.ie> <87k1q49p0i.fsf@tcd.ie> <87efgbbq2p.fsf@tcd.ie> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="22297"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 09 14:52:49 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.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hDqF6-0005eY-Ex for ged-emacs-devel@m.gmane.org; Tue, 09 Apr 2019 14:52:48 +0200 Original-Received: from localhost ([127.0.0.1]:40631 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDqF5-00077r-Fn for ged-emacs-devel@m.gmane.org; Tue, 09 Apr 2019 08:52:47 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:49818) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDqES-00077Q-Ku for emacs-devel@gnu.org; Tue, 09 Apr 2019 08:52:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hDqEQ-0004Z7-Is for emacs-devel@gnu.org; Tue, 09 Apr 2019 08:52:08 -0400 Original-Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]:43821) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hDqEN-0004Wv-FV for emacs-devel@gnu.org; Tue, 09 Apr 2019 08:52:05 -0400 Original-Received: by mail-ed1-x532.google.com with SMTP id w3so5634342edu.10 for ; Tue, 09 Apr 2019 05:52:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=UbMVNat/nasFvKc921UrbTVPhivZ7lHEHAIgqNcksS0=; b=U6AEYGvpapoks6c3Q5TxwvzEHOVaap57tmVAVdh2A3rWb9Qjc4GnGtjx9nbTdBQxQn hUyWRcNTtEva6WdXGLHHnn7FQ86DmK9457G6DPurcfTPeTodmjeIBoyLIUwQMuJW08GL zIcF+ukNIwpCoTfadNYEPDvINKsrq3qaZHENj8HFcLaOnfwr8TrRExGN8/Rw8WRk2TRu IFblbJ4NUnq3so2XPN2zFSgaB3suD1K0bthApl0moCHNQWOIussXqzuVqyNOdzl7emPt DB4sctvNtEacAJPK2dc9PcoVQPBunSxbvnod4ZtA/2D7sI4aA10t8qhz3Y3sYYVAYl9K Ut8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=UbMVNat/nasFvKc921UrbTVPhivZ7lHEHAIgqNcksS0=; b=eDUUGCYBSAjQ8MmfzRRlLdGr6AHpK1Qd4Y+HN2S98HB3FicjQ2fo0KLo/MGC9iYsmY YEXKWKnisQ3+FYmzk7fRXP4erN0VGQBzgffstMq3ena03Od63sEc/QddcHmkV/5V6rME /OsK1PI+GxRlZCyYJ1710Vvb7BBJdohOdeica/D/CAw+g2F3eAdOtqkm8dYR9onINTDH s2Ycgxq45EYVGz6K2mOjv9GkfgzhN/7A3dsOfvoofE9/0ZrPVxAwPNrVYAjMeqrFXVyG LAOjnpcUU2BaxBeDPAaenjBZV3eMhNKrN80BmsH90rcNrXkJqUmJ7FRAuj9R2PCLikBV SKXQ== X-Gm-Message-State: APjAAAXSO36/dPTLzXofw8NhhH+mSP2kienln8xDd6OuTk/i649rqDqN +BWZ08wx4aB1A8b7U0ghDjmNoA== X-Google-Smtp-Source: APXvYqyo8w8rw/vSqmST0Qo+GZ3YNHqmELkBfbDt9NC6xmiCmRKf1YG8Cng9gB07fNGLzVBy3rtohA== X-Received: by 2002:a17:906:374a:: with SMTP id e10mr10509435ejc.182.1554814322036; Tue, 09 Apr 2019 05:52:02 -0700 (PDT) Original-Received: from localhost ([86.43.103.106]) by smtp.gmail.com with ESMTPSA id y5sm3422824eds.7.2019.04.09.05.52.00 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 09 Apr 2019 05:52:00 -0700 (PDT) In-Reply-To: (Paul Eggert's message of "Tue, 10 Jul 2018 20:02:03 -0700") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::532 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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:235162 Archived-At: --=-=-= Content-Type: text/plain The byte-compiler currently optimises various constant expressions, for example: (byte-compile '(string-equal "" "")) ;; => t IWBNI this was also done for proper-list-p: (byte-compile '(proper-list-p '(0))) ;; => (byte-code "\300\301!\207" [proper-list-p (0)] 2) Is the following kosher? --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Make-byte-compiler-aware-of-proper-list-p.patch >From 7a1da041ac6053ec752c3f31072203195c4e24db Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Tue, 9 Apr 2019 13:01:52 +0100 Subject: [PATCH] Make byte-compiler aware of proper-list-p * lisp/emacs-lisp/byte-opt.el: Optimize proper-list-p as a predicate and mark it as side-effect-free. * lisp/emacs-lisp/bytecomp.el: Add one-arg compiler-form for proper-list-p. --- lisp/emacs-lisp/byte-opt.el | 7 ++++--- lisp/emacs-lisp/bytecomp.el | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 33d4964763..4577297bba 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -879,7 +879,8 @@ byte-optimize-memq (put 'symbolp 'byte-optimizer 'byte-optimize-predicate) (put 'stringp 'byte-optimizer 'byte-optimize-predicate) (put 'string< 'byte-optimizer 'byte-optimize-predicate) -(put 'string-lessp 'byte-optimizer 'byte-optimize-predicate) +(put 'string-lessp 'byte-optimizer 'byte-optimize-predicate) +(put 'proper-list-p 'byte-optimizer 'byte-optimize-predicate) (put 'logand 'byte-optimizer 'byte-optimize-predicate) (put 'logior 'byte-optimizer 'byte-optimize-predicate) @@ -1160,8 +1161,8 @@ byte-optimize-set make-list make-string make-symbol marker-buffer max member memq min minibuffer-selected-window minibuffer-window mod multibyte-char-to-unibyte next-window nth nthcdr number-to-string - parse-colon-path plist-get plist-member - prefix-numeric-value previous-window prin1-to-string propertize + parse-colon-path plist-get plist-member prefix-numeric-value + previous-window prin1-to-string proper-list-p propertize degrees-to-radians radians-to-degrees rassq rassoc read-from-string regexp-quote region-beginning region-end reverse round diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 8bbe6292d9..0e953dc96b 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -3566,6 +3566,7 @@ byte-defop-compiler-1 ;;####(byte-defop-compiler move-to-column 1) (byte-defop-compiler-1 interactive byte-compile-noop) +(byte-defop-compiler-1 proper-list-p 1) (defun byte-compile-subr-wrong-args (form n) -- 2.20.1 --=-=-= Content-Type: text/plain Thanks, -- Basil --=-=-=--