[NTG-context] Question about get commalist size

Hans Hagen pragma at wxs.nl
Sat Jun 3 02:00:16 CEST 2006


Taco Hoekwater wrote:
> Aditya Mahajan wrote:
>   
>> Hi,
>>   I tried an example from syst-gen.tex
>>
>> \def\dosomething#1{(#1=\commalistsize) }
>>   \getcommalistsize [\hbox{$a,b,c,d,e,f$}] \dosomething 1
>>   \getcommalistsize [{a,b,c,d,e,f}]        \dosomething 1
>>   \getcommalistsize [{a,b,c},d,e,f]        \dosomething 4
>>   \getcommalistsize [a,b,{c,d,e},f]        \dosomething 4
>>   \getcommalistsize [a{b,c},d,e,f]         \dosomething 4
>>   \getcommalistsize [{a,b}c,d,e,f]         \dosomething 4
>>   \getcommalistsize []                     \dosomething 0
>>   \getcommalistsize [{[}]                  \dosomething 1
>>
>>
>> And it gives me
>>
>> (1=1) (1=6) (4=4) (4=4) (4=4) (4=4) (0=0) (1=1)
>>
>> Notice that
>> \getcommalistsize[{a,b,c,d,e,f}] gives 6. Is this expected behaviour 
>> or a bug?
>>     
>
> Looks like a bug to me, unless Hans changed this on purpose?
>   
nice trick:

\def\getcommalistsize#1]% don't loose [{#1}]
  {\commalistcounter\zerocount
   \processcommalist#1]\p!dogetcommalistsize   
   \edef\commalistsize{\the\commalistcounter}}

-----------------------------------------------------------------
                                          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
-----------------------------------------------------------------



More information about the ntg-context mailing list