From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id AD5032244A for ; Sat, 23 Mar 2024 22:09:56 +0100 (CET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1711228196; b=o0Wenx4utnmJ4V4GIthpQd3Hzm4M3VThMyjydFzPZUrXbvZuZrUr+K3NPjddugXw09oW+6z7+/ Uujg0vNieuTs7HKrjmAQAAgmi34ScAtCEwpU+5Sqj2C/Vqd1vUPwDnd5tOz8aAqyzw9hyakeUU anhPmaITpW/aYrYL6DvXQ4cj1Ow3jvAw3mXLPjG/dJMxja/EpVqn401ZbYIywd2L9RHhWwtcxA T2BfE4bJyJyRBJtU3OnpAH9+0zK1+QEHvsZ7hQ4TzCrHqB76XELRkHx5xD3WFBFsbErcFJGS0U 1aaR5o0Gb2885JjgMSZzpRXNwl45xoEYArFoeyd7r1WSUA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (iris.zentaur.org) smtp.remote-ip=198.58.127.206; dkim=pass header.d=zentaur.org header.s=dkim20200120 header.a=rsa-sha256; dmarc=pass header.from=zentaur.org; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1711228196; bh=DBBXp592ImiYljbjBbV28m2DoL89pub4LzJ1+k0VXYE=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Subject:From:To: MIME-Version:Date:Message-ID:DKIM-Signature:DKIM-Signature; b=XF6N/KwYtxl1QwefQfxKSgOGyShPYU16ApLkOwAA8Y9RddVl3pZfn+mp9BtKtfWiFaCzGKfzhz Rn7yULzwy82K0Cy3uUb2dNu3ksHGnDq1Z0kgB6884DTizWJFl/njoGjqvIdnSE91hnNPi4QZ64 71T1F0xVOMx0u32YZtEo6Ok4my422tR5HQC5GL+qw9oJ3PhZr9wvKSnhlROXvMGm1Zy7EN6sh2 kYddJNRp+OX4lHKMjeB2Yk3XEwfJ5Mq5Li5GEzjD/DlUFeGlSZiFZRYWa2xosjzzdG1Yz0jDhk b3F2TvnyR4hYKIwCMx473ECNkrTFEKXGSLuEWolGSGoHVw==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:Subject:From:To:MIME-Version:Date:Message-ID:Reply-To:Cc: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References; bh=DBBXp592ImiYljbjBbV28m2DoL89pub4LzJ1+k0VXYE=; b=r+Fkv+Ey7+kRDW3LxaA4Du2fEC yu5Lm6cZY6jBJpTVfeDKx8rzTy8xXGRgtte5hNKWHrHnjj5vJa/D+NUg/VNx4O61IHFWHFszjudxd gjW1DKjvhkOpw9aijBoF8KbUFQQ9spxEylI6BfGbakdsZeNonWjQoctohEE92g9gS2PHTq24Tc/JQ KXQsw2FxgwEbj53MW3kuO7HPYllO3oR+bfQwp1Qgy0ai/gGD0oRyooKxxS7LBpXyHZV0I/Wwu0kkX l2ST4cXhzmHS5lZ0HncM5bEBhG/1CJUW4k8sImDu7XPqALq8DHPaD6hklrPLDjmifzgKrtsqejNNu /x0T17vg==; Received: by zero.zsh.org with local id 1ro8cj-000KC7-IY; Sat, 23 Mar 2024 21:09:53 +0000 Authentication-Results: zsh.org; iprev=pass (iris.zentaur.org) smtp.remote-ip=198.58.127.206; dkim=pass header.d=zentaur.org header.s=dkim20200120 header.a=rsa-sha256; dmarc=pass header.from=zentaur.org; arc=none Received: from iris.zentaur.org ([198.58.127.206]:40358) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1ro8cQ-000Jtw-4k; Sat, 23 Mar 2024 21:09:35 +0000 Received: from iris.zentaur.org (localhost [127.0.0.1]) by iris.zentaur.org (Postfix) with ESMTP id 4V2Bf35W3zz3wZv for ; Sat, 23 Mar 2024 21:09:31 +0000 (UTC) Authentication-Results: iris.zentaur.org (amavis); dkim=pass (2048-bit key) reason="pass (just generated, assumed good)" header.d=zentaur.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=zentaur.org; h= content-transfer-encoding:content-type:subject:from:to :content-language:user-agent:mime-version:date:message-id; s= dkim20200120; t=1711228171; x=1711231772; bh=DBBXp592ImiYljbjBbV 28m2DoL89pub4LzJ1+k0VXYE=; b=GGRiR/EXa7HOhkbB+gWkY0GV7/huM4IKCX9 pXCEN5noCgQawvSW8+PJLATfCYUJzcJaylVSejdvgWeWBBpiZtuzJn3ATs+Fkn7U 39EdLgecR8ZH/J7j6gGCtAjS9ntMzIBSNejgD2v4O9DYY9FecwBlggsckUDiOMhL oFBOd4N5Q7eJXV+2T0xSaIY/xfqMZKmVovraSY2tsp6xsi4xn0DtS0dIhIfGkHp4 WPl0uHQdeRDXBJerSkhu4ktpMnaBGiMpUfcu9pVXDv+PwiyiARlAxPQ/cl9ymol5 MKcAV6ZjL6iErXMLi1xuxK8ehPThiB2T0LqTPEJ4mebvbWIRunQ== X-Virus-Scanned: amavis at iris.zentaur.org Received: from iris.zentaur.org ([127.0.0.1]) by iris.zentaur.org (iris.zentaur.org [127.0.0.1]) (amavis, port 10026) with ESMTP id XQFzoWwtULYf for ; Sat, 23 Mar 2024 21:09:31 +0000 (UTC) Received: from [IPV6:2605:a601:a57c:ee00::4000] (unknown [IPv6:2605:a601:a57c:ee00::4000]) by iris.zentaur.org (Postfix) with ESMTPSA id 4V2Bf30vnRz3wZt for ; Sat, 23 Mar 2024 21:09:31 +0000 (UTC) Message-ID: Date: Sat, 23 Mar 2024 16:09:30 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: "zsh-workers@zsh.org" From: Clinton Bunch Subject: Can someone tell me what I'm doing wrong in the YODL? Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Seq: 52799 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: This is the relevant YODL: This is to facilitate a construct like example($a[zrand_int($#a)+1]) rath= er 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 g= oes 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: =C2=A0This is to facilitate a construct like .RS =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 $a[zrand_int($#a)+1] =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 than .RS =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 $a[zrand_int($#a-1)+1] =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Since .RS =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 zrand_int(16) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 possible return values 0-15, in ord= er to use it as an array=20 index which =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 goes from 1-16 you need to add one = since it can=C2=A0 return zero.=C2=A0=20 So=C2=A0 you =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 don't want it to return 16. This is on Rocky Linux 8 (RHEL derivative)