From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/94338 Path: news.gmane.org!not-for-mail From: Wolfgang Schuster Newsgroups: gmane.comp.tex.context Subject: Re: defining a comamnd as variable which behaves as constant Date: Sun, 10 Apr 2016 12:33:23 +0200 Message-ID: <570A2BF3.7080904@gmail.com> References: <57097B99.5010104@gmx.es> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6253048734488651457==" X-Trace: ger.gmane.org 1460284442 5100 80.91.229.3 (10 Apr 2016 10:34:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 10 Apr 2016 10:34:02 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun Apr 10 12:34:01 2016 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1apCgq-0005LC-Ft for gctc-ntg-context-518@m.gmane.org; Sun, 10 Apr 2016 12:34:00 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 37477A285; Sun, 10 Apr 2016 12:33:41 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id J_JZZWaZIeJS; Sun, 10 Apr 2016 12:33:39 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [IPv6:::1]) by zapf.ntg.nl (Postfix) with ESMTP id 465C0A288; Sun, 10 Apr 2016 12:33:39 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id D88C9A285 for ; Sun, 10 Apr 2016 12:33:37 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bIWTCsWADwsx for ; Sun, 10 Apr 2016 12:33:36 +0200 (CEST) Original-Received: from mail-wm0-f53.google.com (mail-wm0-f53.google.com [74.125.82.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id C6EBDA284 for ; Sun, 10 Apr 2016 12:33:26 +0200 (CEST) Original-Received: by mail-wm0-f53.google.com with SMTP id u206so69842567wme.1 for ; Sun, 10 Apr 2016 03:33:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to; bh=ED5U9bVIkWPrL6VCtFH23DyczM7FEfq916E2U2bdQKA=; b=I4SP04XQhc7R+RXq4MeV7bGxBA8DX+FY52Gk4aAPsBuXe2TOcemeL1Q2BItCvt18G9 fR7xDZgDIreu4wCmWMcVjRzEAR1UMNgfH5zzU14vvPW9LngGXJoCW2wiRAeffegxIdzl LVO7YSVq5/OEwq6sFZ3ZJ4hNvNApZCYfiSuWJv7ak6R7N0/0DJeW6Qp7zPSn9JXDnzrM a1Kb0TpgyT8hy/UR+3njTEw207OMEDlzg6BAAg245/9hvZyQFiDohBqFbhH5J30OMRMK lzIAHo2gx8hp+Haq1xtwJ539XPY8LmMXa78+LJrYBfSLNW/UQsSAMlaxyJDb5WYM4taE vg5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to; bh=ED5U9bVIkWPrL6VCtFH23DyczM7FEfq916E2U2bdQKA=; b=WyvQaMSalZAnwNlq5yb4M3Bc4JW78jn+UMJ040+2RS4a+0UyKjnYDUAg3/ogsR75LD 8IaEIk85kF5Hu1Qw04E4j/obH24npYpy/cjf3ePpCV3UdAB5WGUp4h755eHrDru48sgL KBY/EtYZPfGGAG3WUKn35hnKik/3iewVXVBYrIty1IZnW5M5U+30kP5DqToylBQsnwJo EmrRwxvO28Ywu8WksMMEeU+8YB9KXgkVxcADzh/72YmVhN64o1ObQ06q4oHcjcmSCvmT bLgsk20V3JJIK6+aF2JZuYTa2dZzn4Un/5qoXOy4nI7oRllyvS9e0zkbo78tutgKY0QN 0MNA== X-Gm-Message-State: AD7BkJJiE6v2pl4xBEbkp4o7NL1ChVSTSaqjc6Xl7qMBxk+R4DfNdZ5Bf2+CjWqDVdFhFA== X-Received: by 10.28.129.84 with SMTP id c81mr12201613wmd.38.1460284405451; Sun, 10 Apr 2016 03:33:25 -0700 (PDT) Original-Received: from keima.localdomain (x2f248d4.dyn.telefonica.de. [2.242.72.212]) by smtp.gmail.com with ESMTPSA id i5sm22109314wja.23.2016.04.10.03.33.24 for (version=TLSv1/SSLv3 cipher=OTHER); Sun, 10 Apr 2016 03:33:24 -0700 (PDT) User-Agent: Postbox 4.0.8 (Macintosh/20151105) In-Reply-To: <57097B99.5010104@gmx.es> X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.16 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.org gmane.comp.tex.context:94338 Archived-At: This is a multi-part message in MIME format. --===============6253048734488651457== Content-Type: multipart/alternative; boundary="------------070707070200020205010104" This is a multi-part message in MIME format. --------------070707070200020205010104 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit > Pablo Rodriguez > 10. April 2016 um 00:00 > Dear list, > > I have the following document: > > \mainlanguage[es] > \starttext > \startTEXpage[offset=1em] > \dorecurse{27}% > {\def\abcd{\convertnumber{a}{\recurselevel}}% > \dorecurse{27}% > {\abcd\convertnumber{a}{\recurselevel} }\par} > \stopTEXpage > \stoptext > > I want to test all lowercase-letter pairs in Spanish. > > Excuse me for my missing programming notions. For the sample above, I > would need a command that behaves as a variable when defined, but as a > constant when invoked. > > Is there any way to achieve that without using counters? Sorry if there > is too much nonsense in the previous paragraph. But I need to know how > to do it for another example too. You can use Lua to create a list of all character combinations. The convert function takes three argument, the first is the conversion method, the second the conversion value and the third the language (optional and only used by certain conversion methods). \starttext \startluacode for i = 1,27 do for j = 1,27 do context(converters.convert("a",i,"es")) context(converters.convert("a",j,"es")) context.par() end end \stopluacode \stoptext Wolfgang --------------070707070200020205010104 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
10= .=20 April 2016 um 00:00
Dear list,

I hav= e=20 the following document:

\mainlanguage[es]
\starttext \startTEXpage[offset=3D1em]
\dorecurse{27}%
=20 {\def\abcd{\convertnumber{a}{\recurselevel}}%
=20 \dorecurse{27}%
=20 {\abcd\convertnumber{a}{\recurselevel} }\par}
\stopTEXpage
=20 \stoptext

I want to test all lowercase-letter pairs in Spanish.
Excuse me for my missing programming notions. For the sample above, I
would need a command that behaves as a variable when defined, but as a
cons= tant when invoked.

Is there any way to achieve that without using=20 counters? Sorry if there
is too much nonsense in the previous=20 paragraph. But I need to know how
to do it for another example too.
You can use Lua to create a list of all character combinations. The=20 convert function
takes three argument, the first is the conversion method, the second the conversion
value and the third the language (optional and only used by certain=20 conversion methods).


\starttext

\startluacode
for i =3D 1,27 do
=C2=A0=C2=A0=C2=A0 for j =3D 1,27 do
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 context(converters.convert("a",i,"e= s"))
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 context(converters.convert("a",j,"e= s"))
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 context.par()
=C2=A0=C2=A0=C2=A0 end
end
\stopluacode

\stoptext

Wolfgang
--------------070707070200020205010104-- --===============6253048734488651457== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly90ZXguYWFuaGV0Lm5ldAphcmNoaXZlICA6IGh0dHA6Ly9mb3VuZHJ5LnN1cGVsZWMu ZnIvcHJvamVjdHMvY29udGV4dHJldi8Kd2lraSAgICAgOiBodHRwOi8vY29udGV4dGdhcmRlbi5u ZXQKX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX18= --===============6253048734488651457==--