From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HTML_MESSAGE,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 26553 invoked from network); 10 Jan 2024 21:23:13 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 10 Jan 2024 21:23:13 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1704921793; b=YzBm7sL+cUZ/e6Oh3yfK8tVTQtyZqES2tddfRtLPdAafg1jyh42k2jH4DecHTeC68S7FwUTdSG Eb0Dr6ctm7Vd4J9kFCbtAgFQngCjVKTq/9Bc6b5ku6IIzqR44dIH2g+mdnU9Urtdbe4b9OnB+I PxaBib1St1NXAvsGjg56bxKFCLKgGow9MD01Lvvo8T8uLHGuVckTv62FaBtzjfEizrmtTCvr7u NxyVwRhM7TAnplEjCYjvhWC4qXh6kwSu4YunsIZsexw51SlghN5T7/eAkdZqGVwTyIhMB8yNpJ +JBKLPdwVu3K86Ip4RLeQ1o0BQPKfwkLesLdw3ukJKLmXA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mta03.eastlink.ca) smtp.remote-ip=24.224.136.9; dmarc=none header.from=eastlink.ca; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1704921793; bh=T/TL5km31a9rRFKxxMxi423F/vGGRAYGtRpA1+YnjBw=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Content-Type:DKIM-Signature; b=ZAi0N9JHWTlaAIQKcTSj4Ir9ro0XtmuHu5dwMDsXaQp+km/Jf+BaVBJoWLW92hqmjh3CnBB0Ts CHL7igZmXDaC4RBaK9zUkPYcuAIiHH29jF3+7o8/MCgOxY6X3IVbfRN0YJFiPqnmbS6za3kx78 FCKir7H/wm5myF3Hs0AOP6nkeHWpO6om64s3CiR41jzM+h0MB/BIA4lN03Okt7jAp0bHw1km8Q ODdvS1UJH6YyRjMI/VoVBphN7YFk1Qk4Oq1xW1ewUVWGDZ7iflqyZstEpUwejekppqVgAhxvrJ kemcwopp8k3FSv0kRQMWwRq0zQLmlsBr0lKGysETqS2zRA==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-reply-to:From:References:Cc:To: Subject:MIME-version:Date:Message-id:Content-type:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=dlT7m24fIe3VDGO1hIrhKUpEyeI+BXvmQjtUnMvWQHo=; b=fWkoWmcqan4/56r8sKueMhB3FL ecf7BSv2yBcvPpU7abJreho2g1EzZ724+y6O4AC65QmYeMtIymkYlrW8WB5cLS/FBlYdG+FDEZ8RM Z0M+oCu0zfht5AMFhP6K2e9Picgn8LU+TfU85KHB6k4RwhZCsbwv0wxRjrEC9jwcISf18wIwLm+U6 nJkpH6Udwj+X+m1bHxClvIKGz2lYForFFrYodD/c2+EE0lNo+/bVYSDYvWm8DJasjn5GmHMrw4BeF RJ769mhqs1l7JSkj8AWaShNYD8+LPH5YBy73cej4c/5OorjwURN8dqkn7KGokQYE0Vrcqhhdq34iD jiufwdXA==; Received: by zero.zsh.org with local id 1rNg2a-000GmP-Pr; Wed, 10 Jan 2024 21:23:12 +0000 Authentication-Results: zsh.org; iprev=pass (mta03.eastlink.ca) smtp.remote-ip=24.224.136.9; dmarc=none header.from=eastlink.ca; arc=none Received: from mta03.eastlink.ca ([24.224.136.9]:40439) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1rNg1q-000G4K-TJ; Wed, 10 Jan 2024 21:22:27 +0000 Received: from csp01.eastlink.ca ([71.7.199.166]) by mta03.eastlink.ca ([24.224.136.9]) with ESMTPS id <0S721MV1EDQHDTD1@mta03.eastlink.ca> for zsh-users@zsh.org; Wed, 10 Jan 2024 17:22:26 -0400 (AST) Received: from [192.168.0.11] (host-24-207-19-13.public.eastlink.ca [24.207.19.13]) by csp01.eastlink.ca ([71.7.199.166]) with ESMTPSA id Ng1prlj4NAItUNg1prCMBj (version=TLSv1_2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256); Wed, 10 Jan 2024 17:22:26 -0400 X-Authority-Analysis: v=2.4 cv=NJYTuW2g c=1 sm=1 tr=0 ts=659f0a92 a=e7T7DzMKK1R988ZCg0wLyw==:117 a=e7T7DzMKK1R988ZCg0wLyw==:17 a=r77TgQKjGQsHNAKrUKIA:9 a=Hou8B2DACUNQVfR5eywA:9 a=QEXdDO2ut3YA:10 a=zZCYzV9kfG8A:10 a=pGLkceISAAAA:8 a=xgVlVkDu9fnsy9IjND0A:9 a=p3oqNK6kH4-HKSBC:21 a=_W_S_7VecoQA:10 X-Vade-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdeiuddgudegiecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfgtefuvffnkffpmfdpqfgfvfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurheptgfkffggfgfuvfevfhfhjgesrgdtreertddvjeenucfhrhhomheptfgrhicutehnughrvgifshcuoehrrgihrghnughrvgifshesvggrshhtlhhinhhkrdgtrgeqnecuggftrfgrthhtvghrnhepvefhjeetffejffetvdejffdugfehudevgedvfeeihfffgfelueelkedttedujeehnecukfhppedvgedrvddtjedrudelrddufeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvgedrvddtjedrudelrddufedphhgvlhhopegludelvddrudeikedrtddruddungdpmhgrihhlfhhrohhmpehrrgihrghnughrvgifshesvggrshhtlhhinhhkrdgtrgdpnhgspghrtghpthhtohepfedprhgtphhtthhopeerredprhgtphhtthhopehstghhrggvfhgvrhessghrrghsshhlrghnthgvrhhnrdgtohhmpdhrtghpthhtohepiihshhdquhhsvghrshesiihshhdrohhrghdpghgvthdqkghiphfrrghsshifugepthhruhgv X-Vade-Score: -100 X-Vade-State: 0 X-EL-AUTH: rayandrews@eastlink.ca Content-type: multipart/alternative; boundary="------------vwZQ4AeBquSywkRQkCsZaisG" Message-id: <2f9aae73-0c8d-4fe0-a466-52cac95fe295@eastlink.ca> Date: Wed, 10 Jan 2024 13:22:24 -0800 MIME-version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: proxy name for array Content-language: en-US To: Bart Schaefer Cc: zsh-users@zsh.org References: <41f9b4d6-8f4a-4220-a86a-b7ccf690bd89@eastlink.ca> <2546420c-deb1-4dd7-a0e8-7b9db463503c@eastlink.ca> <4e5aa5cf-dfad-4e0c-ac38-8631d1c4ccbc@eastlink.ca> From: Ray Andrews In-reply-to: X-Seq: 29445 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: This is a multi-part message in MIME format. --------------vwZQ4AeBquSywkRQkCsZaisG Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2024-01-10 13:11, Bart Schaefer wrote: > Yes, you could avoid temp with > set -A "${${(P)1}[pages]}[2]" 50 > set -A "${${(P)1}[pages]}[3]" 100 > set -A "${${(P)1}[pages]}[4]" 150 > > but that's not as clear or easily maintainable. You could also do Agreed.  If I won't have a clue what I was doing in six months then KISS is best. > temp=${${(P)1}[pages]} # Note one less (P) and not an array > set -A "${temp}[2]" 50 > set -A "${temp}[3]" 100 > set -A "${temp}[4]" 150 Once I have this running -- the real function -- I'll try that. > or even > > set -A "${temp}[2,4]" 50 100 150 No, because in the real function there's work to determine what the values will be, they can't be assigned ahead of time. --------------vwZQ4AeBquSywkRQkCsZaisG Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit


On 2024-01-10 13:11, Bart Schaefer wrote:
Yes, you could avoid temp with
  set -A "${${(P)1}[pages]}[2]" 50
  set -A "${${(P)1}[pages]}[3]" 100
  set -A "${${(P)1}[pages]}[4]" 150

but that's not as clear or easily maintainable.  You could also do
Agreed.  If I won't have a clue what I was doing in six months then KISS is best.
  temp=${${(P)1}[pages]}  # Note one less (P) and not an array
  set -A "${temp}[2]" 50
  set -A "${temp}[3]" 100
  set -A "${temp}[4]" 150
Once I have this running -- the real function -- I'll try that.
or even

  set -A "${temp}[2,4]" 50 100 150

No, because in the real function there's work to determine what the values will be, they can't be assigned ahead of time.


--------------vwZQ4AeBquSywkRQkCsZaisG--