From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Why is FUNC in cl-callf not allowed to be an expression? Date: Fri, 10 May 2019 09:28:14 -0400 Message-ID: References: <874l631ek1.fsf@web.de> <87pnoqtuhm.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="108829"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Michael Heerdegen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri May 10 15:28:25 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 1hP5ZY-000SAq-2E for ged-emacs-devel@m.gmane.org; Fri, 10 May 2019 15:28:24 +0200 Original-Received: from localhost ([127.0.0.1]:43368 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP5ZW-00022Y-W7 for ged-emacs-devel@m.gmane.org; Fri, 10 May 2019 09:28:23 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:60098) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP5ZQ-00022Q-RL for emacs-devel@gnu.org; Fri, 10 May 2019 09:28:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hP5ZP-0007hd-W3 for emacs-devel@gnu.org; Fri, 10 May 2019 09:28:16 -0400 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:52561) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP5ZP-0007hQ-Qp for emacs-devel@gnu.org; Fri, 10 May 2019 09:28:15 -0400 Original-Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id x4ADSE8o016224; Fri, 10 May 2019 09:28:14 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 2D59C6AE94; Fri, 10 May 2019 09:28:14 -0400 (EDT) In-Reply-To: <87pnoqtuhm.fsf@web.de> (Michael Heerdegen's message of "Fri, 10 May 2019 13:32:53 +0200") 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, RV6543=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6543> : inlines <7074> : streams <1821121> : uri <2842745> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.20 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:236369 Archived-At: >> > (defmacro gv-callf (call &optional n) >> > (gv-letplace (_getter setter) (nth (or n 1) call) >> > (funcall setter call))) >> >> It's cute, tho I'm not too fond of specifying the place via a number, >> personally, > > [I should use GETTER btw for more efficient code: > > (defmacro gv-callf (call &optional n) > (unless n (setq n 1)) > (gv-letplace (getter setter) (nth n call) > (setf (nth n call) getter) > (funcall setter call))) > ] > > Yes, but still better than having it as part of the macro name as in > cl-callf2... I don't have any better idea currently. We could still > extend cl-callf however. While it doesn't solve the problem, while playing with it I noticed that I'm less annoyed by the use of a number if I can put it first, as in: (gv-callf 2 (append head (car x) (cdr x))) I'm not sure I can say why, tho. Stefan