From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Heime via Users list for the GNU Emacs text editor Newsgroups: gmane.emacs.help Subject: Re: Making alist that executes multiple commands Date: Mon, 25 Nov 2024 22:50:03 +0000 Message-ID: References: <87frnf6n2l.fsf@rub.de> <87bjy36m2w.fsf@rub.de> <877c8r6l8e.fsf@rub.de> <8734jf6k4s.fsf@rub.de> Reply-To: Heime Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9744"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Heime via Users list for the GNU Emacs text editor To: Stephen Berman Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Nov 25 23:50:56 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 1tFhuw-0002Kf-GS for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 25 Nov 2024 23:50:54 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tFhuL-0006bw-Hi; Mon, 25 Nov 2024 17:50:17 -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 1tFhuI-0006bV-Fi for help-gnu-emacs@gnu.org; Mon, 25 Nov 2024 17:50:14 -0500 Original-Received: from mail-40138.protonmail.ch ([185.70.40.138]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tFhuG-0005lu-AH for help-gnu-emacs@gnu.org; Mon, 25 Nov 2024 17:50:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1732575007; x=1732834207; bh=BiUBsXKns1TWK6GjU18Ro6REyQNKR5Af1wMMEplgwbs=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post; b=xVUfLdDVu6f46tdTbxgj20pu75ISeRFFUb+5BvXni7+oqX5/PvvpNiGo2h4flApTH UTHTdJP8t8HYVrz4hx5S9C5rmY1hnXcLgSrqb0YkdJ7vkbajLdFTYmJGvATrU6Prnd DaCrKxeeSBfgVw8UAyLe4m+HIQvvs4jXTKASD2uIfEIJ9jiMHjaT+XOY5GxVL+g/OU mjlSzunKTGfqGQWrVsfD8Off18Q523qjHpWO1Td6AjZ3ymlY7z8HzTns+oSjUZ0UQu V+BvJ5zOP8cTZTvOEdQnP8RwRUDpj5onWqpAeBvQFJ7XD7Fll1ykyYxdr7A08N02a1 GR3gm3nJeWYPg== In-Reply-To: <8734jf6k4s.fsf@rub.de> Feedback-ID: 57735886:user:proton X-Pm-Message-ID: 5c89586d28e1d489a3a223b7565ee45387608623 Received-SPF: pass client-ip=185.70.40.138; envelope-from=heimeborgia@protonmail.com; helo=mail-40138.protonmail.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham 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:148403 Archived-At: 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 wrote= : >=20 > > About your comment > >=20 > > > That seems fine if the functions take no arguments, though probably n= ot > > > as flexible as looping over a list. > >=20 > > You provided the examples > >=20 > > (funcall 'alkotr-ar ar) > > (funcall 'alkotr-ar af) > >=20 > > But I did not understand how to inceorporate this idea. With > > my lambda function, I can also pass arguments to my commands. > >=20 > > I did not understand the implication of the following in my case. > >=20 > > (dolist (f '(+ - list)) > > (dolist (a '(1 2 3)) > > (funcall f a))) > >=20 > > Thusly, I do not understand what "allow arguments to be freely combined= " > > actually means practically. >=20 >=20 > 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 anything > 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=20 to perform arithmetic operations. Since only a single argument=20 is provided, this will result in an error. So I have done=20 (dolist (f '(+ - list)) (dolist (a '(1 2 3)) (dolist (b '(4 5 6)) ;; Adding another argument (message "Result of %s: %s" f (funcall f a b))))) Producing Result of +: 5 Result of +: 6 Result of +: 7 Result of +: 6 Result of +: 7 Result of +: 8 Result of +: 7 Result of +: 8 Result of +: 9 Result of -: -3 Result of -: -4 Result of -: -5 Result of -: -2 Result of -: -3 Result of -: -4 Result of -: -1 Result of -: -2 Result of -: -3 Result of list: (1 4) Result of list: (1 5) Result of list: (1 6) Result of list: (2 4) Result of list: (2 5) Result of list: (2 6) Result of list: (3 4) Result of list: (3 5) Result of list: (3 6) It is a good exercise but not the kind of mixing I was thinking about. I just have a set of commands that I want to run according to some setting 'argm or 'go. Or do both with '(argm go). That's all. I think the lamdba gets this done. The arguments to any of the commands in the lambda can com= e from external settings as well right, global variables and can introduce=20 conditionals as well. Which should be what I require. Or would you know about something else. Is there ways the implementation can break? =20