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: Mon, 20 May 2019 22:01:09 -0400 Message-ID: References: <874l631ek1.fsf@web.de> <87pnoqtuhm.fsf@web.de> <87r2961gox.fsf@web.de> <87mujohasa.fsf@web.de> <87a7fn3c6c.fsf@web.de> <875zqabh3t.fsf@web.de> <87zhnma11c.fsf@web.de> <871s0y3weo.fsf@web.de> <87tvdshew9.fsf@web.de> <87k1ek673s.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="13442"; 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 Tue May 21 04:02:15 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 1hSu6Y-0003OA-AT for ged-emacs-devel@m.gmane.org; Tue, 21 May 2019 04:02:14 +0200 Original-Received: from localhost ([127.0.0.1]:45016 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSu6X-0000vk-9S for ged-emacs-devel@m.gmane.org; Mon, 20 May 2019 22:02:13 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:43311) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSu5p-0000ve-AX for emacs-devel@gnu.org; Mon, 20 May 2019 22:01:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSu5o-0007gk-Cq for emacs-devel@gnu.org; Mon, 20 May 2019 22:01:29 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:42221) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hSu5o-0007fq-5l for emacs-devel@gnu.org; Mon, 20 May 2019 22:01:28 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id ACA191011B6; Mon, 20 May 2019 22:01:26 -0400 (EDT) Original-Received: from mail02.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 7275F1007CC; Mon, 20 May 2019 22:01:25 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1558404085; bh=1An3uOaHCVmCA+fYBzM+fdqEZE8OU7HsCfvoMxjqNbc=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=SDcOAZbGwOIbBqVLNCbwU6EcJPMjE/fAKTUefY/I0C1BmraVnEqhUXyCidP+swTHA tlsvaVTVOtZ/RS1ZDhd+7AmGNTfRkF5HmlItDwfQcONrZNRO5DPIVqQyiCjroSPxB/ Ajz+lk8sp4jFK5cqxIRtXsLIPj0pcDZhVczxMm+03Fxuf+2hi1FyeLppsjkI5wRhBK l4nlEL8w9TaasCzMAQHFwTPJJd+LBr3kjdotnrx928NBHd/JzXW07UX2Kl6LlZyUw5 ySkLhY5F311+mEq69U38xSGl7Bbio5bfVuEYhHQrpejj0wDNcxWxaANmkwqEIo50Yw 7QkgMnITx/cdw== Original-Received: from alfajor (unknown [216.154.3.168]) by mail02.iro.umontreal.ca (Postfix) with ESMTPSA id 2D1AC120402; Mon, 20 May 2019 22:01:25 -0400 (EDT) In-Reply-To: <87k1ek673s.fsf@web.de> (Michael Heerdegen's message of "Tue, 21 May 2019 01:25:59 +0200") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 132.204.25.50 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:236832 Archived-At: > Sorry that I haven't been clear: I want EXPR to eval to the function to > be applied, not to the expression to set to. Like in > > (cl-callf (with (if flag #'1+ #'1-)) my-number) Note that the gv-modify macro we discussed does not allow that either: it doesn't funcall the result of an EXPR. So, what you want can be written (cl-callf (lambda (x) (if flag (1+ x) (1- x))) my-number) or (cl-callf (lambda (x) (funcall (if flag #'1+ #'1-) x)) my-number) Just like you'd have to write (gv-modify my-number (if flag (1+ it) (1- it))) or (gv-modify my-number (funcall (if flag #'1+ #'1-) it)) Stefan