From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/30421 Path: news.gmane.org!not-for-mail From: nico Newsgroups: gmane.comp.tex.context Subject: Re: How to \processcommalist inside another commalist? Date: Mon, 21 Aug 2006 19:17:57 +0200 Message-ID: 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 1156180369 23371 80.91.229.2 (21 Aug 2006 17:12:49 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 21 Aug 2006 17:12:49 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Mon Aug 21 19:12:47 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 1GFDJz-0006vv-MB for gctc-ntg-context-518@m.gmane.org; Mon, 21 Aug 2006 19:12:22 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 6FBB61FD24; Mon, 21 Aug 2006 19:12:18 +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 24837-03; Mon, 21 Aug 2006 19:12:07 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 553D91FCBB; Mon, 21 Aug 2006 19:12:07 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 5093B1FCBB for ; Mon, 21 Aug 2006 19:12:01 +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 25436-01-2 for ; Mon, 21 Aug 2006 19:11:53 +0200 (CEST) Original-Received: from swip.net (mailfe13.tele2.fr [212.247.155.140]) by ronja.ntg.nl (Postfix) with SMTP id D20B31FCB7 for ; Mon, 21 Aug 2006 19:11:52 +0200 (CEST) X-T2-Posting-ID: 3brHPWvyEzVNt0QNlxQWsxGJRDYe7rueGgqwO1zxZAg= X-Cloudmark-Score: 0.000000 [] Original-Received: from [83.179.209.137] (HELO localhost) by mailfe13.swip.net (CommuniGate Pro SMTP 5.0.8) with ESMTP id 91026831 for ntg-context@ntg.nl; Mon, 21 Aug 2006 19:11:50 +0200 Original-To: "mailing list for ConTeXt users" In-Reply-To: <6faad9f00608210823p5beef0feia8b53c7ce734f83a@mail.gmail.com> User-Agent: Opera M2/7.54 (FreeBSD, build 955) 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:30421 Archived-At: 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? \def\arePrime[#1]{% \bgroup \processcommalist[#1]\printPrime \egroup} %% Expand the parameter before processing \def\arePrimeN[#1]{% \bgroup \getparameters[Prime][p=,#1] \expandafter\processcommalist\expandafter[\Primep]\printPrime \egroup} \starttext \arePrime[2,3,5] \arePrimeN[p={2,3,5}] \stoptext Regards, BG