From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.help Subject: Re: Closures - do you understand them well? Date: Sun, 11 Dec 2022 10:13:28 +0100 Message-ID: <871qp6nvz2.fsf@gnu.org> References: <87lenh7vrn.fsf@web.de> <87tu25d77o.fsf@gnu.org> <87h6y5pt8k.fsf@web.de> <87bkodpqnk.fsf@web.de> <87k030tlfh.fsf@web.de> <87ilikxgkd.fsf@web.de> <87y1rf1txv.fsf@gnu.org> <87fsdmy8xl.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3148"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.9.4; emacs 30.0.50 Cc: help-gnu-emacs@gnu.org To: Michael Heerdegen Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 11 10:15:00 2022 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p4IQF-0000bw-Pa for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 11 Dec 2022 10:14:59 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p4IPe-0005Di-5W; Sun, 11 Dec 2022 04:14:22 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p4IPb-0005DX-5g for help-gnu-emacs@gnu.org; Sun, 11 Dec 2022 04:14:19 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p4IPa-0000Ob-Cp; Sun, 11 Dec 2022 04:14:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-reply-to:Date:Subject:To:From: References; bh=tJRGRsB1lxXU08Q2YFVAtFG5wjw+Rr9XMYJxkilDTYg=; b=UyYbwKzK32xl4v dgVvixsAhFLE06HyG+2MK2sD3aEPSWC/NOR3oWNFV4Jqe8hkAyyXtCJsZgRFFXejDK+dQGrVynV/z j2zEdKHKCNEFBaXFiEc+nQF4xAUVLoJ6/JJviHeU3X7qu28YuMZNLr7DgZY7OC+SlpNcFmtUR2Vpa U1MAJmNyVBnirHmw5YkPIfLDEB0yYwMowOgnOkIRSlGA89XvOATa0NoeUfdDmqE371u6OgxevkxM5 nAFq42Hrz/GQPV2awF39o+4XtR/EG7HeFDyzYMP+z+gjx6+n4ZU2hFFnIPqZEBkUFfilfxfoqFoku 4r0ZaJnaoVIgVWLM4x3Q==; Original-Received: from auth2-smtp.messagingengine.com ([66.111.4.228]) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p4IPW-0003zg-Rq; Sun, 11 Dec 2022 04:14:16 -0500 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailauth.nyi.internal (Postfix) with ESMTP id 9590F27C0054; Sun, 11 Dec 2022 04:14:12 -0500 (EST) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Sun, 11 Dec 2022 04:14:12 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdeigddtvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpehffgfhvfevufffjgfkgggtsehttdertddtredtnecuhfhrohhmpefvrghsshhi lhhoucfjohhrnhcuoehtshguhhesghhnuhdrohhrgheqnecuggftrfgrthhtvghrnhepud ejtdehuddvleffjeekteegvdehleehvdeufefhueekkeekhedvgfeggeffvefgnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhrnhdomh gvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqkeeijeefkeejkeegqdeifeehvdel kedqthhsughhpeepghhnuhdrohhrghesfhgrshhtmhgrihhlrdhfmh X-ME-Proxy: Feedback-ID: ib2b94485:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 11 Dec 2022 04:14:11 -0500 (EST) In-reply-to: <87fsdmy8xl.fsf@web.de> X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:141635 Archived-At: Michael Heerdegen writes: >> Where's the difference to >> this inlined version which returns (101 ... 101)? >> >> (let ((i 0) (funs)) >> (while (<= (cl-incf i) 100) >> (push (lambda (&rest args2) >> (apply #'identity (append (list i) args2))) >> funs)) >> (mapcar #'funcall (nreverse funs))) > > Well - `apply-partially' is a function and I use a simple function call, > so it is precisely not just something inlined: The important point is > that only the _value_ of the variable i passed, not the variable or > a reference to it: > > #+begin_src emacs-lisp > (let ((i 27)) > (apply-partially #'identity i)) > ==> > (closure > ((args . (27)) > (fun . identity)) > (&rest args2) > (apply fun (append args args2))) > #+end_src Thanks, that explains it. Bye, Tassilo