* Can someone tell me what I'm doing wrong in the YODL?
@ 2024-03-23 21:09 Clinton Bunch
2024-03-23 21:55 ` Bart Schaefer
0 siblings, 1 reply; 2+ messages in thread
From: Clinton Bunch @ 2024-03-23 21:09 UTC (permalink / raw)
To: zsh-workers
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)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Can someone tell me what I'm doing wrong in the YODL?
2024-03-23 21:09 Can someone tell me what I'm doing wrong in the YODL? Clinton Bunch
@ 2024-03-23 21:55 ` Bart Schaefer
0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2024-03-23 21:55 UTC (permalink / raw)
To: Clinton Bunch; +Cc: zsh-workers
On Sat, Mar 23, 2024 at 2:09 PM Clinton Bunch <cdb_zsh@zentaur.org> wrote:
>
> This is to facilitate a construct like example($a[zrand_int($#a)+1]) rather
example() can't be inlined, you have to put it on a line by itself.
If you want an inlined example, we usually use
`tt(the example)'
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-03-23 21:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-23 21:09 Can someone tell me what I'm doing wrong in the YODL? Clinton Bunch
2024-03-23 21:55 ` Bart Schaefer
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).