![](https://secure.gravatar.com/avatar/6114858d84b0f40cf715f12237ab67a1.jpg?s=120&d=mm&r=g)
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