From: Hans Hagen <pragma@wxs.nl>
Subject: Re: How to \processcommalist inside another commalist?
Date: Mon, 21 Aug 2006 23:04:47 +0200 [thread overview]
Message-ID: <44EA1FEF.5050809@wxs.nl> (raw)
In-Reply-To: <6faad9f00608211135r4639b3c5s3eda3346257fed90@mail.gmail.com>
Mojca Miklavec wrote:
> On 8/21/06, nico wrote:
>
>> On Mon, 21 Aug 2006 17:23:48 +0200, Mojca Miklavec wrote:
>>
>>
>>> Hello,
>>>
>>> I tried to print out primes (well, I tried to do something else, but I
>>> needed a more illustrative example), but it seems that my approach was
>>> too naive:
>>>
>>> \def\arePrime[#1]{%
>>> \bgroup
>>> \getparameters[Prime][p=,#1]
>>> \def\printPrime##1{##1 is prime.\crlf}
>>> \processcommalist[\Primep]\printPrime
>>> \egroup}
>>>
>>> \starttext
>>> \arePrime[p={2,3,5}]
>>> \stoptext
>>>
>> My 2 cents contribution:
>>
>> \def\printPrime#1{#1 is prime.\crlf}
>>
>> %% Why using parameter for this?
>>
>
> I was sure that someone would ask that. I want to provide optional
> parameters for both numbers and scaling:
> \useGNUPLOTgraphic[name]
> or
> \useGNUPLOTgraphic[name][width=.9\textwidth]
> or
> \useGNUPLOTgraphic[name][n={1,3}]
> or
> \useGNUPLOTgraphic[name][n={1,3},width=.9\textwidth]
>
> but after some thinking I realized that it would indeed be a better
> idea (less to type?) to have
> \useGNUPLOTgraphic[name][1,3]
> and
> \useGNUPLOTgraphic[name][1,3][width=.9\textwidth]
> instead.
>
>
along these lines:
\def\useGNUPLOTgraphic
{\dotripleempty\douseGNUPLOTgraphic}
\def\douseGNUPLOTgraphic[#1][#2][#3]%
{\itthirdargument
\dodouseGNUPLOTgraphic[#1][#2][#3]%
\else\ifsecondargument
\def\docommand##1{\dodouseGNUPLOTgraphic[#1][##1][#3]}%
\processcommalist[#2]\docommand
\fi}
\def\dodouseGNUPLOTgraphic[#1][#2][#3]%
{\getparameters[#1:#2][#3]}
etc etc
you can also check for \doifsssignmentelse{#2}{...}{...}
> At the beginning the main reason against it
Hans
--
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
prev parent reply other threads:[~2006-08-21 21:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-21 15:23 Mojca Miklavec
2006-08-21 17:17 ` nico
2006-08-21 18:07 ` Taco Hoekwater
2006-08-21 18:35 ` Mojca Miklavec
2006-08-21 20:51 ` nico
2006-08-21 21:08 ` Hans Hagen
2006-08-21 22:26 ` nico
2006-08-22 8:13 ` Hans Hagen
2006-08-21 21:04 ` Taco Hoekwater
2006-08-23 20:43 ` Mojca Miklavec
2006-08-21 21:04 ` Hans Hagen [this message]
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=44EA1FEF.5050809@wxs.nl \
--to=pragma@wxs.nl \
--cc=ntg-context@ntg.nl \
/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.
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).