From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#27584: 26.0.50; alist-get: Add optional arg TESTFN Date: Thu, 06 Jul 2017 11:07:14 -0400 Message-ID: References: <87tw2rva7v.fsf@calancha-pc> <87mv8j6y1z.fsf@petton.fr> <87y3s2m76v.fsf@calancha-pc> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1499353695 1545 195.159.176.226 (6 Jul 2017 15:08:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 6 Jul 2017 15:08:15 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: Nicolas Petton , 27584@debbugs.gnu.org To: Tino Calancha Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jul 06 17:08:08 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dT8Nz-00004u-IL for geb-bug-gnu-emacs@m.gmane.org; Thu, 06 Jul 2017 17:08:07 +0200 Original-Received: from localhost ([::1]:51909 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dT8O5-0007LK-0a for geb-bug-gnu-emacs@m.gmane.org; Thu, 06 Jul 2017 11:08:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53998) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dT8Ny-0007LC-UG for bug-gnu-emacs@gnu.org; Thu, 06 Jul 2017 11:08:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dT8Nw-0005DI-8Z for bug-gnu-emacs@gnu.org; Thu, 06 Jul 2017 11:08:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:52599) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dT8Nw-0005D0-4I for bug-gnu-emacs@gnu.org; Thu, 06 Jul 2017 11:08:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dT8Nu-0006Cz-7d for bug-gnu-emacs@gnu.org; Thu, 06 Jul 2017 11:08:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 06 Jul 2017 15:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27584 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 27584-submit@debbugs.gnu.org id=B27584.149935363823815 (code B ref 27584); Thu, 06 Jul 2017 15:08:02 +0000 Original-Received: (at 27584) by debbugs.gnu.org; 6 Jul 2017 15:07:18 +0000 Original-Received: from localhost ([127.0.0.1]:55276 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dT8NC-0006C3-FS for submit@debbugs.gnu.org; Thu, 06 Jul 2017 11:07:18 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:34118) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dT8NA-0006Bv-G9 for 27584@debbugs.gnu.org; Thu, 06 Jul 2017 11:07:17 -0400 Original-Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id v66F7Ew1000654; Thu, 6 Jul 2017 11:07:14 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 08F3B66273; Thu, 6 Jul 2017 11:07:14 -0400 (EDT) In-Reply-To: (Tino Calancha's message of "Thu, 6 Jul 2017 15:20:49 +0900 (JST)") X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 2 Rules triggered EDT_SA_DN_PASS=0, RV6065=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6065> : inlines <5969> : streams <1753027> : uri <2457317> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:134261 Archived-At: >>> 1. In my patch `assoc-predicate' is a defsubst. >>> Should does exit at all? >>> If yes: >>> *) should be a defun instead? >>> **) should be named `assoc-predicate' or differently? >> It's been called cl-assoc so far ;-) > Some day your dream will be fulfilled, and `cl-lib' will be preloaded at > startup. I'm not sure it's my dream, to tell you the truth: I like Scheme's choice of not treating "keyword symbols" specially, so macros can use them (because the keyword args aren't evaluated), but not functions. This ensures that the cost of keyword-argument parsing is only paid during macro expansion (where it's tolerable) but not at run-time (where it's much too costly and hence absolutely requires compiler-macro crutches). > Then, we will not need things like `assoc-predicate'. In reality, my intention, beside putting a smiley, was to point you to another implementation which uses defun with a compiler-macro instead of defsubst. Actually your assoc-predicate might be a good candidate for define-inline (which is in dire need of documentation. I can't believe its author still hasn't bothered to put even a docstring). Something like (define-inline assoc-predicate (elem list &optional pred) (inline-letevals (elem list pred) (pcase (inline-const-val pred) ('eq (inline-quote (assq ,elem ,list))) ((or 'equal 'nil) (inline-quote (assoc ,elem ,list))) (_ (inline-quote (assoc-default ,elem ,list ,pred nil 'full)))))) -- Stefan