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: Tue, 26 Nov 2024 08:46:13 +0000 Message-ID: References: <87bjy36m2w.fsf@rub.de> <877c8r6l8e.fsf@rub.de> <8734jf6k4s.fsf@rub.de> <87y1166h9u.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="34922"; 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 Tue Nov 26 09:47:15 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 1tFrE2-0008u8-VG for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 26 Nov 2024 09:47:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tFrDO-00034Z-1K; Tue, 26 Nov 2024 03:46:34 -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 1tFrDJ-00034C-Ag for help-gnu-emacs@gnu.org; Tue, 26 Nov 2024 03:46:29 -0500 Original-Received: from mail-0201.mail-europe.com ([51.77.79.158]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tFrDH-0002H0-4N for help-gnu-emacs@gnu.org; Tue, 26 Nov 2024 03:46:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1732610780; x=1732869980; bh=BlWi0IVnm1cPo7BDHXe2ee8cB/zz+R+cU49cHe0zysc=; 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=RUUAyqnt0jIMcUbb6454VpYmTVBWeBRTrzYfxakFT1MmkjP5BirXp1hFn0L5N1D2i s90b/l8NMijbqe8KTkG+1XBCgPoaNzd3rVdra9Oxk20fnq+J9BuknI+SAtSCG652Nl PdEHXENsY+d2WQK7a02f04C8k+sLJ0Y5yvxzmK0+pjtd4V9/ugd+UcBwJo3GCP2n4R Uf8sZv6bA/UEGVYLxVse1MYljxe6b7W/e64jLBAGEtw1i8tonMU9BeBnsZIP43GqMy LXijhayfojrwd/Vv9HFPvOoScB8jQqCZfaMwqbsmqKB2j1HA9ESaJZOkjPlyaHk2J8 wSRC5P7bvlIIw== In-Reply-To: <87y1166h9u.fsf@rub.de> Feedback-ID: 57735886:user:proton X-Pm-Message-ID: e77f96a43fb2b16e6ccec1182a615342d6a19bed Received-SPF: pass client-ip=51.77.79.158; envelope-from=heimeborgia@protonmail.com; helo=mail-0201.mail-europe.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=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:148407 Archived-At: Sent with Proton Mail secure email. On Tuesday, November 26th, 2024 at 11:11 AM, Stephen Berman wrote: > On Mon, 25 Nov 2024 22:50:03 +0000 Heime heimeborgia@protonmail.com wrote= : >=20 > > Sent with Proton Mail secure email. > >=20 > > On Tuesday, November 26th, 2024 at 10:09 AM, Stephen Berman > > stephen.berman@gmx.net wrote: > >=20 > > > On Mon, 25 Nov 2024 21:59:53 +0000 Heime heimeborgia@protonmail.com w= rote: > > >=20 > > > > About your comment > > > >=20 > > > > > That seems fine if the functions take no arguments, though probab= ly not > > > > > 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 comb= ined" > > > > actually means practically. > > >=20 > > > It produces all combinations of function calls comprised of one of th= e > > > functions f and one of the arguments a; I did not mean to imply anyth= ing > > > else. If it doesn't help with your use case, then of course don't use > > > it. > >=20 > > I worked through it a little bit > >=20 > > (dolist (f '(+ - list)) > > (dolist (a '(1 2 3)) > > (funcall f a))) > >=20 > > 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. >=20 >=20 > The functions `+' and` -' take any number of numbers (including none). > I don't know why you got an error; I don't: >=20 > (let (ret) > (dolist (f '(+ - list)) > (dolist (a '(1 2 3)) > (push (funcall f a) ret))) > ret) > =3D=3D> >=20 > ((3) (2) (1) -3 -2 -1 3 2 1) You are quite right. I saw nil and thought it failed. It did not after doing (dolist (f '(+ - list)) (dolist (a '(1 2 3)) (message "Result of %s: %s" f (funcall f a )) )) =20 > [...] >=20 > > I just have a set of commands that I want to run according to some sett= ing > > 'argm or 'go. Or do both with '(argm go). That's all. I think the lamdb= a > > 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 introduc= e > > conditionals as well. Which should be what I require. Or would you know > > about something else. Is there ways the implementation can break? >=20 >=20 > 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. >=20 > Steve Berman Right, I now understand the mixing of list of arguments with a list of function names. Such mixing is not what I had in mind. Just wanted a set a commands in a function which is not defined externally.