From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: uzibalqa Newsgroups: gmane.emacs.help Subject: Re: Looping through arguments &rest Date: Mon, 03 Jul 2023 22:24:32 +0000 Message-ID: References: <874jmk65cu.fsf@gmx.net> 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="8961"; mail-complaints-to="usenet@ciao.gmane.io" Cc: uzibalqa 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 Jul 04 00:25:28 2023 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 1qGRz5-000281-QZ for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 04 Jul 2023 00:25:27 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qGRyQ-00079q-Um; Mon, 03 Jul 2023 18:24:46 -0400 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 1qGRyP-00079e-Rc for help-gnu-emacs@gnu.org; Mon, 03 Jul 2023 18:24:45 -0400 Original-Received: from mail-4325.protonmail.ch ([185.70.43.25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qGRyM-0000f6-Am for help-gnu-emacs@gnu.org; Mon, 03 Jul 2023 18:24:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=protonmail; t=1688423079; x=1688682279; bh=w/xVf1yC9Z8g79O7nFA5KV5xwlH9dl6FiZVwql9G+ws=; 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; b=cY3yCmJIaDK3hf/Z52DwgM8fFsQG+aRttxQqMkv60WgMYxX2sJGEOHe+wpE69AEto iUjrVHoIXj1bsMvbXePjIwv/a2cZgAD6WX0oyMNZuZ/ixbiGrukZadZE8j+wUmFRb2 z3cZ/+2bk6BW2ZGivauO1OOP6lfVk13SXWmSLabjeKZF2bwfkR9e5lDG8YP2bfI0ts +bKaR/S0/hFOLEfk44EJ/ykqxZaY58M8A9HF7iFqbL8y2kP6pQHXA5OoRNERD9jvmh h01gbZxfgDUOBbvQ0H1mGHWuE8y5ZCanKSS4toNRELMZN9BhDNKq0/hNQEYWFCqxIn wY12KzGjCTTaw== In-Reply-To: <874jmk65cu.fsf@gmx.net> Feedback-ID: 52887082:user:proton Received-SPF: pass client-ip=185.70.43.25; envelope-from=uzibalqa@proton.me; helo=mail-4325.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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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:144104 Archived-At: ------- Original Message ------- On Tuesday, July 4th, 2023 at 9:40 AM, Stephen Berman wrote: > On Mon, 03 Jul 2023 20:32:25 +0000 uzibalqa uzibalqa@proton.me wrote: >=20 > > Why does "attach" keep "chart" nil > >=20 > > (setq chart '()) > > (setq entry1 '("A" "B" "C")) > > (setq entry2 '("D" "E" "F")) > >=20 > > (defun attach (chart &rest linsq) > > "TODO" > > (dolist (tbrow linsq) > > (push tbrow chart))) >=20 >=20 > The argument `chart' is local to the function` attach', changing it > within the function has no effect on the global variable `chart'. Also,` = dolist' without a RESULT argument returns nil, so either add `chart' as RES= ULT or make` chart' the last line in the function body so it will be > the return value. >=20 > > I want to have the equivalent to > >=20 > > (push entry1 chart) > > (push entry2 chart) >=20 >=20 > Set the value of the global variable `chart' to the result of calling` at= tach' (modified as above). >=20 > Steve Berman Works well indeed. Then "chart" as argument to "attach" becomes superflous= , right ? We can go without it.