From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2276 invoked by alias); 23 Sep 2015 20:45:11 -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: 20637 Received: (qmail 19031 invoked from network); 23 Sep 2015 20:45:10 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 X-Authority-Analysis: v=2.1 cv=T/C1EZ6Q c=1 sm=1 tr=0 a=62AtbbSsrca3scplPJj5lw==:117 a=62AtbbSsrca3scplPJj5lw==:17 a=N659UExz7-8A:10 a=a3HIm222D3wvmKkjazYA:9 a=pILNOxqGKmIA:10 Message-id: <56030F52.8060009@eastlink.ca> Date: Wed, 23 Sep 2015 13:45:06 -0700 From: Ray Andrews User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Icedove/31.7.0 MIME-version: 1.0 To: zsh-users@zsh.org Subject: Re: easy References: <20150911191854.59bcadb5@ntlworld.com> <5602CC56.8080501@eastlink.ca> <150923124553.ZM32030@torch.brasslantern.com> In-reply-to: <150923124553.ZM32030@torch.brasslantern.com> Content-type: text/plain; charset=windows-1252; format=flowed Content-transfer-encoding: 7bit On 09/23/2015 12:45 PM, Bart Schaefer wrote: > } $ test () { echo @[2,-1]; } > > Presume you're missing a $ in $@ there ... Pardon. > } $ test one two three four five > } two three four five > } > > If you grasp that indexing from the left starts at one rather than > at zero, why is it not "intuitive" that indexing from the right also > starts at (negative) one rather than zero? Ah. I was trying to make sense of it as 'subtract one element from the end'. Which would make more sense as 'subtract zero elements from the end' (in this case). But as 'echo from the second element from the left up to the first element from the right', then '-1' is not a 'subtraction' rather it is the last element AKA the first element from the right. Perfectly logical as I thought it would be. Tx. Once you see the logic in something you can never forget it cuz it makes sense, as that does. Actually that's much better anyway because both numbers are indices rather than one being an index and one being a mathematical operation. Just hafta remember that the dash does not mean subtraction, rather it means index from the right.