zsh-users
 help / color / mirror / code / Atom feed
From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: Re: easy
Date: Wed, 23 Sep 2015 13:45:06 -0700	[thread overview]
Message-ID: <56030F52.8060009@eastlink.ca> (raw)
In-Reply-To: <150923124553.ZM32030@torch.brasslantern.com>

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.





      reply	other threads:[~2015-09-23 20:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-11 18:18 5.1.1 available Peter Stephenson
2015-09-23 15:59 ` easy Ray Andrews
2015-09-23 19:45   ` easy Bart Schaefer
2015-09-23 20:45     ` Ray Andrews [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56030F52.8060009@eastlink.ca \
    --to=rayandrews@eastlink.ca \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).