From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6589 invoked by alias); 12 Jan 2013 01:44:20 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17554 Received: (qmail 14878 invoked from network); 12 Jan 2013 01:44:08 -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.5 required=5.0 tests=BAYES_05,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_NONE, T_DKIM_INVALID,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=1357954694; bh=BZiZ0mCtmkSQltRNl+wsqeqcQUFz5yygWSzLopH/NPs=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:Received:cc:In-reply-to:From:References:To:Subject:MIME-Version:Content-Type:Content-ID:Date:Message-ID; b=4HVjilvxnDi4tQVwKH5Ck5nt1H+UlYRmw5nfYgJjyWLvzNvBWkcQzNAvt6apiRhX0OeoAwLwpUfKzVOcPfjkMn4a9dcQDI3Lw0Jewtvp18McRy1SSDMysnvolN8fIU46XTbU13dGgUs9JqGuaPCVevSOlkCdUb5LSo3h39LzbpE= X-Yahoo-Newman-Id: 728873.94515.bm@smtp129.mail.ird.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: zWVXfPsVM1lfLRG8B.AvPobr3s51MyFaWd7b.v1llJ8YwjH 7tgg6COKWD4N5Su3bjaLinVHI9jOOO.bzb2VPxG_tfRhlfzSRhFypzjyhcV3 HIQ.QYHCuWLm7Tkl1KHc5mPEAu97MsXqY3.2ughL8slutSJBiKh.0wpW2F8Q CVeDyYG3tVJFswo3dOx3cOnHIdwp6cUHWow2vLcc6Do0cM2AQF9YjXV1cWug 3PhfapkRavJD0esfPzOn0jJmvu5EmLxkbTuB8Tcg2UMDe8rcHoLywmXOzO2W IJfJ5xsFdzvWquIGdqO_DsZqrWVTJ82AeVD2Lw1BEcahoSBTL5vQ9UhKHrZS VqgNsGElSKk3zCu9aYGJaRO0E58mkZXatk8k5EiN_VaB.eU30GelFoqbG1NA 2ZtjQtCF5UcvtCauE_6Lm_g6LF_O_RoBi9aldboTL5GxSZg-- X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- cc: zsh-users@zsh.org In-reply-to: <50EFB80D.30002@sergio.spb.ru> From: Oliver Kiddle References: <50EFB80D.30002@sergio.spb.ru> To: sergio Subject: Re: array prepend MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <22415.1357954689.1@thecus.kiddle.eu> Date: Sat, 12 Jan 2013 02:38:13 +0100 Message-ID: <22417.1357954693@thecus.kiddle.eu> serio wrote: > Is there a way for prepend array like += for append, > or the only possible solution is a = (b $a)? a=(b $a) is the only proper documented way to prepend elements There are some hacks that do the job such as: a[-1-$#a]=(b) I'm not sure whether I'd rely on that always working in the future, however. If you dig out the mailing list discussion from when += was added you'll see that the main reason there isn't a prepend is that we couldn't think of suitable syntax that would be backward compatible. -= for example isn't possible because a - character is valid in an identifier. Oliver