From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27135 invoked by alias); 14 Jan 2013 15:54:39 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 30967 Received: (qmail 17903 invoked from network); 14 Jan 2013 15:54:36 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_NONE, T_DKIM_INVALID,T_TO_NO_BRKTS_FREEMAIL,UNPARSEABLE_RELAY autolearn=no version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at yahoo.co.uk does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1358178498; bh=+VrJZWyPM4el5MpDaEnhljiigVeOFWdoc2g55Jrvvho=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:Received:In-reply-to:From:References:To:Subject:Date:Message-ID; b=B44mY5rZyWuabacJDG2JcECuYBZg6IKg44xisCW/Zpg22G6KEotAwptM/qIQgDdSZr8OHPi9F4Y2fJyca66t4T5zb344MQC7pRFhlGN+0/NaZyMCDeelpikQbjFY2Ud6Z9FVd3uv50Qgr38UefPBqHaS5H3n3Yj+F2BuTQIXTEM= X-Yahoo-Newman-Id: 885340.29903.bm@smtp134.mail.ird.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: bPbn0AwVM1mMEXUEjgaNXkyzOpqzhopxtv.7nR6AbMcJMpi 6UcHMTGNXBI2mWsY01MYMmgdlW_e10ew10.wtEE2sOM5dHZ8XI7tY0p9D9zR 7zun8MkCmvFkzNL.IcUaU2P0Yk2BzHeb11VtFXyCM4SGvH1Cu2rmnPtNeMCm _91Q0qqYsD2iwa8K6PjQA7sFjYzEXYFcr8ss95VojUr8emGJs4eXmQPiHR9T V_5nXpay6._jmZZMbJEU9UAPyrjZyoE__Zw5v0jfz2kP2dlyTOVYh7vH6Mzg rmm4FBJ3xLPISc4tIxRw.KAfpS3j0OlafRL3HUyafyP9O3rXqy1TOnoXtrGs SwfsA8hTxCHrDhkAoxh063bCdnxXjiMM0pouXplg79tvflnHpvHzMopx5tU4 3sf7zRHDE7yp06vjbYgH10oj1OYg7ZcDEZ9GWRrpWJHimww-- X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- In-reply-to: <130113175023.ZM5855@torch.brasslantern.com> From: Oliver Kiddle References: <50EFB80D.30002@sergio.spb.ru> <22417.1357954693@thecus.kiddle.eu> <20130113185141.4394d532@pws-pc.ntlworld.com> <130113175023.ZM5855@torch.brasslantern.com> To: zsh-workers@zsh.org Subject: Re: array prepend Date: Mon, 14 Jan 2013 16:48:17 +0100 Message-ID: <12358.1358178497@thecus.kiddle.eu> Bart wrote: > Hrm, I'm not exactly excited by that choice, /= implies some sort of > division rather than union. I was thinking of ^= (given the meaning of ^ in a regex) but that also implies a mathematical operation. Also note that the current += does do addition given integer variables much as i=foo is also sensitive to an existing integer i variable. > Thinking again, I'm not sure that's the reason. There doesn't seem to > be any syntactic reason to exclude -= (it doesn't parse now); rather, > =+ doesn't work because a + character is valid in the parameter value, > but I think -= was rejected on the same implied-semantics grounds that > I just raised for /=. You're right, with -= it looks for a matching command name. Digging back in the mail archives it seems I've remembered the reasons wrongly. > What about a special case for empty brackets? VAR[] is not currently > a valid identifier even though e.g. VAR[*] is. > > VAR[]=(this is prepended) > VAR[]+=(this is appended) > VAR+=(short for 'VAR[]+=') That seems reasonably logical. Would the following be possible to prepend to an array element? VAR[1][]="first" Oliver