From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, URIBL_SBL_A autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 9408 invoked from network); 25 Aug 2023 10:49:22 -0000 Received: from cgl.ntg.nl (5.39.185.202) by inbox.vuxu.org with ESMTPUTF8; 25 Aug 2023 10:49:22 -0000 Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 11F8B482E15 for ; Fri, 25 Aug 2023 12:47:36 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sYcNXWuncTtu for ; Fri, 25 Aug 2023 12:47:35 +0200 (CEST) Received: from cgl.ntg.nl (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id C23D9482D19 for ; Fri, 25 Aug 2023 12:46:53 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 059C14828A3 for ; Fri, 25 Aug 2023 12:46:27 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HEla1grhHpt7 for ; Fri, 25 Aug 2023 12:46:26 +0200 (CEST) Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cgl.ntg.nl (Postfix) with ESMTPS id 85510482589 for ; Fri, 25 Aug 2023 12:46:26 +0200 (CEST) Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-5230a22cfd1so1115311a12.1 for ; Fri, 25 Aug 2023 03:46:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692960386; x=1693565186; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=7TNAiDW55OzbUn18dGWcXdQKTFClZTnuqYfMvd0iMUw=; b=MGfc4hIBeGWaLr7cDVRVuvj91sx/uAUjBmdZPizLGf7uvVPe9HXy6GA5SIL6Gtv0ml X9AwB17XCgalysGa6NeJUy0D3jW5z2hpCylSufoC3YA2zZv70U6CK/N9xyvxyMGaqXKe qIz5qtlPLyo7E9ZAgnduNVvfCgfB5kNkPk3BySYommD+DSVi6kOYsNVeOs2Hglntm3Pj iXot4lZflJs465g58uz240kSN2exHs31d1XDBW1Qh1+MfM4LCcPZL0anD4JumPtCIKga tSyoQ7oOSdzxakxskzy77DENSrr0K+DE92ZKoHUOzfJhnUbyC+S5SgdQhqTISxoSkZs8 r2bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692960386; x=1693565186; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7TNAiDW55OzbUn18dGWcXdQKTFClZTnuqYfMvd0iMUw=; b=lcJKzTLGYQ4wg53I+RBHqM4WDgmiJbitCY2a6TzLnO7Z8VV+/wWNBYp9cbnqd3mDII nWPbGSQZ5qELDK1KXwIZQPkT3nMgSC7xp14rGPQQIR1KEAX1o3n9JDvWpdMK6M6qKTLe 9SDPgYV/9zEcJETF4UZGHfFz8bhi1v7fjX6KtDA8VnnWIVhXXwf5aYV9nmPt25wW8cL4 0N6pLcOBBQ/7URuQrv+N3eFWsqCu3THcLBKDt5pISjfROxps1Hms9NhCPEnGuaNaZ3IQ zuYNjrAGKPTmEyzTqUrtoOnOeAwRnrGBeJqWukq+8iBBD2jwdB5lTGajz5LI5VvNpX4x hEiA== X-Gm-Message-State: AOJu0YxlFTNCoIhi46Ox/T+FLIDUjBrdXaghABnsMvoFiqbOp9XsKv06 NiJ8laGqV847K2R1szR2fYUZ7aeDNm1BDOEmaqExfcb1694= X-Google-Smtp-Source: AGHT+IHfFlbavu3UzjFMVPQSWqE8Tg5HHqQoAhhd1C+3hg+LXgzSXiWJ1F0Q932xew3H70LhsevYaGZ4wDIXNs34RMU= X-Received: by 2002:a05:6402:2051:b0:523:cbc0:8d2d with SMTP id bc17-20020a056402205100b00523cbc08d2dmr13045086edb.18.1692960385389; Fri, 25 Aug 2023 03:46:25 -0700 (PDT) MIME-Version: 1.0 References: <81c7dc1a-c6e9-3b4e-abba-f9ac574aad2a@gmail.com> <0D8E23FE-0CC5-4D07-AD38-566AF5F7326A@gmail.com> In-Reply-To: From: Fabrice Couvreur Date: Fri, 25 Aug 2023 12:47:23 +0000 Message-ID: To: mailing list for ConTeXt users Message-ID-Hash: AGQTQC7JGZ7KYHRFUERWVNIEBNI5OEY6 X-Message-ID-Hash: AGQTQC7JGZ7KYHRFUERWVNIEBNI5OEY6 X-MailFrom: fabrice1.couvreur@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list Reply-To: mailing list for ConTeXt users Subject: [NTG-context] Re: Question about building an array of values with Lua List-Id: mailing list for ConTeXt users Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: multipart/mixed; boundary="===============8952702357617466438==" --===============8952702357617466438== Content-Type: multipart/alternative; boundary="00000000000063d7300603bd0e6e" --00000000000063d7300603bd0e6e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Wolfgang, Thank you so much Fabrice Le jeu. 24 ao=C3=BBt 2023 =C3=A0 19:46, Wolfgang Schuster < wolfgang.schuster.lists@gmail.com> a =C3=A9crit : > Otared Kavian schrieb am 24.08.2023 um 12:50: > > > On 24 Aug 2023, at 06:03, Wolfgang Schuster < > wolfgang.schuster.lists@gmail.com> wrote: > > [=E2=80=A6] > > > I would drop the column check in this case. > > for i =3D 0,9 do > context.startxrow() > context.startxcell() > context(i) > context.stopxcell() > context.startxcell() > context(math.mod(i*i,10)) > context.stopxcell() > context.startxcell() > context(i) > context.stopxcell() > context.startxcell() > context(math.mod(2*i*i,10)) > context.stopxcell() > context.stopxrow() > end > > Wolfgang > > > Indeed this is much more elegant=E2=80=A6 It feels so good to be on this = list and > learn from such insights :-) > > > We don't even need the math.mod function because Lua added with version > 5.1 a modulo operator, > the loop to create the row can now be changed to > > for i =3D 0,9 do > context.startxrow() > context.startxcell() > context(i) > context.stopxcell() > context.startxcell() > context(i * i % 10) > context.stopxcell() > context.startxcell() > context(i) > context.stopxcell() > context.startxcell() > context(2 * i * i % 10) > context.stopxcell() > context.stopxrow() > end > > Wolfgang > > > _________________________________________________________________________= __________ > If your question is of interest to others as well, please add an entry to > the Wiki! > > maillist : ntg-context@ntg.nl / > https://www.ntg.nl/mailman/listinfo/ntg-context > webpage : https://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : https://contextgarden.net > > _________________________________________________________________________= __________ --00000000000063d7300603bd0e6e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Wolfgang,
Thank you so much
Fabrice

Le=C2=A0jeu. 24= ao=C3=BBt 2023 =C3=A0=C2=A019:46, Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>= ; a =C3=A9crit=C2=A0:
Otared Kavian schrieb am 24.08.2023 um 12:50:
=20
On 24 Aug 2023, at 06:03, Wolfgang Schuster <wolfgang.schuster.lists@gmail.com> wrote:<= /div>
[=E2=80=A6]

I would drop the column check in this case.

=C2=A0=C2=A0=C2=A0 for i =3D 0,9 do
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 context.startxrow()
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 context.= startxcell()
=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=C2=A0=C2=A0 context(i)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 context.= stopxcell()
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 context.= startxcell()
=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=C2=A0=C2=A0 context(math.mod(i*i,10))
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 context.= stopxcell()
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 context.= startxcell()
=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=C2=A0=C2=A0 context(i)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 context.= stopxcell()
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 context.= startxcell()
=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=C2=A0=C2=A0 context(math.mod(2*i*i,10))
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 context.= stopxcell()
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 context.stopxrow()
=C2=A0=C2=A0=C2=A0 end

Wolfgang

Indeed this is much more elegant=E2=80=A6 It feels so good to be on = this=20 list and learn from such insights :-)

We don't even need the math.mod function because Lua added with version= =20 5.1 a modulo operator,
the loop to create the row can now be changed to

=C2=A0=C2=A0=C2=A0 for i =3D 0,9 do
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 context.startxrow()
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 context.= startxcell()
=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=C2=A0=C2=A0 context(i)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 context.= stopxcell()
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 context.= startxcell()
=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=C2=A0=C2=A0 context(i * i % 10)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 context.= stopxcell()
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 context.= startxcell()
=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=C2=A0=C2=A0 context(i)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 context.= stopxcell()
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 context.= startxcell()
=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=C2=A0=C2=A0 context(2 * i * i % 10)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 context.= stopxcell()
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 context.stopxrow()
=C2=A0=C2=A0=C2=A0 end

Wolfgang

___________________________________________________________________________= ________
If your question is of interest to others as well, please add an entry to t= he Wiki!

maillist : ntg-cont= ext@ntg.nl / https://www.ntg.nl/mailman/listinfo/= ntg-context
webpage=C2=A0 : https://www.pragma-ade.nl / http://context.aanhet.net
archive=C2=A0 :
https://bitbucket.org/phg/context-m= irror/commits/
wiki=C2=A0 =C2=A0 =C2=A0: https://contextgarden.net
___________________________________________________________________________= ________
--00000000000063d7300603bd0e6e-- --===============8952702357617466438== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ --===============8952702357617466438==--