zsh-workers
 help / color / mirror / code / Atom feed
From: Clinton Bunch <cdb_zsh@zentaur.org>
To: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Can someone tell me what I'm doing wrong in the YODL?
Date: Sat, 23 Mar 2024 16:09:30 -0500	[thread overview]
Message-ID: <b7ab325b-253e-44aa-a693-0c811c0679ae@zentaur.org> (raw)

This is the relevant YODL:

This is to facilitate a construct like example($a[zrand_int($#a)+1]) rather
than example($a[zrand_int+LPAR()$#a-1+RPAR()+1]).
Since example(zrand_int+LPAR()16RPAR()) has 16
possible return values 0-15, in order to use it as an array index which goes
from 1-16 you need to add one since it can return zero. So you don't want it
to return 16.

This is the resultant section of man page:

  This is to facilitate a construct like .RS
               $a[zrand_int($#a)+1]
               than .RS
               $a[zrand_int($#a-1)+1]
        Since .RS
        zrand_int(16)
        possible return values 0-15, in order to use it as an array 
index which
        goes from 1-16 you need to add one since it can  return zero.  
So  you
        don't want it to return 16.


This is on Rocky Linux 8 (RHEL derivative)



             reply	other threads:[~2024-03-23 21:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-23 21:09 Clinton Bunch [this message]
2024-03-23 21:55 ` Bart Schaefer

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=b7ab325b-253e-44aa-a693-0c811c0679ae@zentaur.org \
    --to=cdb_zsh@zentaur.org \
    --cc=zsh-workers@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).