From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/30425 Path: news.gmane.org!not-for-mail From: "Mojca Miklavec" Newsgroups: gmane.comp.tex.context Subject: Re: How to \processcommalist inside another commalist? Date: Mon, 21 Aug 2006 20:35:27 +0200 Message-ID: <6faad9f00608211135r4639b3c5s3eda3346257fed90@mail.gmail.com> References: <6faad9f00608210823p5beef0feia8b53c7ce734f83a@mail.gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1156185378 8715 80.91.229.2 (21 Aug 2006 18:36:18 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 21 Aug 2006 18:36:18 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Mon Aug 21 20:36:15 2006 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by ciao.gmane.org with esmtp (Exim 4.43) id 1GFEd3-00007Y-JM for gctc-ntg-context-518@m.gmane.org; Mon, 21 Aug 2006 20:36:05 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id B34F81FE0C; Mon, 21 Aug 2006 20:36:03 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 30397-05; Mon, 21 Aug 2006 20:35:56 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 438541FE06; Mon, 21 Aug 2006 20:35:56 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 0C56C1FE06 for ; Mon, 21 Aug 2006 20:35:53 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 30298-09-2 for ; Mon, 21 Aug 2006 20:35:47 +0200 (CEST) Original-Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.190]) by ronja.ntg.nl (Postfix) with SMTP id EE4FF1FD51 for ; Mon, 21 Aug 2006 20:35:27 +0200 (CEST) Original-Received: by nf-out-0910.google.com with SMTP id d4so440929nfe for ; Mon, 21 Aug 2006 11:35:27 -0700 (PDT) Original-Received: by 10.49.93.13 with SMTP id v13mr8115463nfl; Mon, 21 Aug 2006 11:35:27 -0700 (PDT) Original-Received: by 10.78.175.15 with HTTP; Mon, 21 Aug 2006 11:35:27 -0700 (PDT) Original-To: "mailing list for ConTeXt users" In-Reply-To: Content-Disposition: inline X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.7 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:30425 Archived-At: 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. At the beginning the main reason against it was that I didn't know how to distinguish which kind of parameters are being used in the second pair of brackets, but I guess that I can safely use \ifnumberelse as a test on the first item to distinguish between the two. > %% Expand the parameter before processing > \def\arePrimeN[#1]{% > \bgroup > \getparameters[Prime][p=,#1] > \expandafter\processcommalist\expandafter[\Primep]\printPrime > \egroup} On 8/21/06, Taco Hoekwater wrote: > And an equivalent is > > \processcommacommand[\Primep]\printPrime Thanks to both of you! Mojca