From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.help Subject: Re: Making alist that executes multiple commands Date: Tue, 26 Nov 2024 00:11:09 +0100 Message-ID: <87y1166h9u.fsf@rub.de> References: <87frnf6n2l.fsf@rub.de> <87bjy36m2w.fsf@rub.de> <877c8r6l8e.fsf@rub.de> <8734jf6k4s.fsf@rub.de> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7259"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Heime via Users list for the GNU Emacs text editor To: Heime Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Nov 26 00:12:25 2024 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 1tFiFk-0001jk-Dl for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 26 Nov 2024 00:12:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tFiEu-0000hp-An; Mon, 25 Nov 2024 18:11:32 -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 1tFiEo-0000hW-TU for help-gnu-emacs@gnu.org; Mon, 25 Nov 2024 18:11:26 -0500 Original-Received: from mout.gmx.net ([212.227.17.20]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tFiEb-0008Q7-AC for help-gnu-emacs@gnu.org; Mon, 25 Nov 2024 18:11:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1732576270; x=1733181070; i=stephen.berman@gmx.net; bh=Jvc/YLW1Q6H8r2G4L1r7nWxGrtOA8W3G7FggnVqQup0=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=sGjY+V4FSMZQJbFflUTUWLIHQGnT1+xCggVuPp5kyKYFwxE0JajjXcBp1s4veg10 ZqFB1Lv+wB99Gapgc/h0bV7XE7qAqyN8vCM17+q8z3D1K263kbMfinioMkG8n2RSr ChxE9GU0hTzlebYUTIPjURagwE3zizWcyt7PYVF19T1c3cR/HTcADUF/PFn1OmkUY gZWSmGsTK/Ngke2NGX+kpJx5+FXHQwPpFtXwIyU0hIg9xzPL6c1ctcPdDsbWFe78A jirHh8XNpfHpjvhwRp6RzySNw00iBzonpedmt43nPLWeeVh15Iy+ULmQ5sbWNecCo eb1CuBt02ag9Tyv84A== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from strobelfssd ([88.130.50.169]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1McY8T-1tpsWp0jzJ-00bb2e; Tue, 26 Nov 2024 00:11:10 +0100 In-Reply-To: (Heime's message of "Mon, 25 Nov 2024 22:50:03 +0000") X-Provags-ID: V03:K1:aOCv2VcH42WTI1XIC3JPjb+I0y3L+EXkgJOOr90rP4jGLDXulH6 Oo0icVryFPw6/bCCHFEJ3shN4G41PZjnqzry0o2FOGqDamJvuPHrsmi2Exb+NjPDBsNh92A flyB+Mo7HsH3B3Tmoq+R/Zc5q7kXWjwTcsFMm90WSY9VgCflcNoCmIrGxiDgZxnmTIBrnaF pVZ0vYv2XOyQQhSkVFrOg== UI-OutboundReport: notjunk:1;M01:P0:IEWjak/BuTU=;LoQvl3OIaReUFdKbxv648/SJUI9 QhWHYXjYja2JpS82O7IEJO1XOXWJ9AMEs80mW5JO7HgF4z6O3LokFx6Xbbi1mEA7PqR9gA7GX JCx1Wmz7lJepU4z7oUICsc/X9SGMEH0FJmBGhUIleuJ2tDtiof9ViO1UcA6XehrqRIhLs1Gbk 6Dw5HpK/VSYwgFPV4hlGriLXFwT/iPU0Vt8obmhmDA+z6zjZp610WQufs1P4y7o2lUCYyrHKU 3710h10eUAIbjv9KZnYgIhAKyYZ9piOxPxEtkD1bwo7yaUGI/cVeq7Rs+gwZzQUmpyvI5mTQX d/scNrFrD8seWR+s8MxA+spfNpgZ49YwvzhEDlsqQm1gkvw0eZ+XXE+VooZLnLwtNP/UguaRj NsfwdBkJGqx4ZuLVCjBq8OKOnlRzJbAi6WnY1A8+69dTg4Q2pqC1QSOMF8j2oqiKgPKGqgCI+ ZlUAMjoDuBlyENTUZk5rUwMAb6kHasQRgQfF8rv5fLXu8AySNwW8lS2jk1SqB6aQDYUlgp/E0 IsKNOOagBbno6YJgldHOb9YWqvucoFB2UhOj5UXwLJ2xdeM2lpjTLsvpk7p2G2QXCsttxIWol 6Bws8/DtoHRuIlcasCKUyVPz7DDIMPLet1LFnRm3cXah1BTuC2AEvmvamxnhcZiK3MgxRRVt2 HZ/j14uyxJ/e9Y9z2geyxp3kWVBALKsunLQK4WWTV+8Dn79836O0txZbzxA2PDenrwzksLw3k 98OiZfAqrMuRoA0BLBSQZ0CuowdONl6TJKxg8YfJ+a6jE2+CJ27xizYJXthZwcebW1a6Z2CH Received-SPF: pass client-ip=212.227.17.20; envelope-from=stephen.berman@gmx.net; helo=mout.gmx.net X-Spam_score_int: 5 X-Spam_score: 0.5 X-Spam_bar: / X-Spam_report: (0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_SBL_CSS=3.335, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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:148405 Archived-At: On Mon, 25 Nov 2024 22:50:03 +0000 Heime wrot= e: > Sent with Proton Mail secure email. > > On Tuesday, November 26th, 2024 at 10:09 AM, Stephen Berman > wrote: > >> On Mon, 25 Nov 2024 21:59:53 +0000 Heime heimeborgia@protonmail.com wro= te: >> >> > About your comment >> > >> > > That seems fine if the functions take no arguments, though probably= not >> > > as flexible as looping over a list. >> > >> > You provided the examples >> > >> > (funcall 'alkotr-ar ar) >> > (funcall 'alkotr-ar af) >> > >> > But I did not understand how to inceorporate this idea. With >> > my lambda function, I can also pass arguments to my commands. >> > >> > I did not understand the implication of the following in my case. >> > >> > (dolist (f '(+ - list)) >> > (dolist (a '(1 2 3)) >> > (funcall f a))) >> > >> > Thusly, I do not understand what "allow arguments to be freely combin= ed" >> > actually means practically. >> >> >> It produces all combinations of function calls comprised of one of the >> functions f and one of the arguments a; I did not mean to imply anythin= g >> else. If it doesn't help with your use case, then of course don't use >> it. > > I worked through it a little bit > > (dolist (f '(+ - list)) > (dolist (a '(1 2 3)) > (funcall f a))) > > Which fails for + and -, Elisp requires at least two arguments > to perform arithmetic operations. Since only a single argument > is provided, this will result in an error. The functions `+' and `-' take any number of numbers (including none). I don't know why you got an error; I don't: (let (ret) (dolist (f '(+ - list)) (dolist (a '(1 2 3)) (push (funcall f a) ret))) ret) =3D=3D> ((3) (2) (1) -3 -2 -1 3 2 1) [...] > I just have a set of commands that I want to run according to some setti= ng > 'argm or 'go. Or do both with '(argm go). That's all. I think the lam= dba > gets this done. The arguments to any of the commands in the lambda can = come > from external settings as well right, global variables and can introduce > conditionals as well. Which should be what I require. Or would you kno= w > about something else. Is there ways the implementation can break? I already said if it does what you want, that's fine. I can't prove for you it will always work, so if you find a case where it doesn't work, feel free to show it. Until then, I think this discussion has run its course. Steve Berman