ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Question about get commalist size
@ 2006-06-02 20:28 Aditya Mahajan
  2006-06-02 21:38 ` Taco Hoekwater
  0 siblings, 1 reply; 3+ messages in thread
From: Aditya Mahajan @ 2006-06-02 20:28 UTC (permalink / raw)


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?

Aditya

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Question about get commalist size
  2006-06-02 20:28 Question about get commalist size Aditya Mahajan
@ 2006-06-02 21:38 ` Taco Hoekwater
  2006-06-03  0:00   ` Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Taco Hoekwater @ 2006-06-02 21:38 UTC (permalink / raw)


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?

Taco

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Question about get commalist size
  2006-06-02 21:38 ` Taco Hoekwater
@ 2006-06-03  0:00   ` Hans Hagen
  0 siblings, 0 replies; 3+ messages in thread
From: Hans Hagen @ 2006-06-03  0:00 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-06-03  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-02 20:28 Question about get commalist size Aditya Mahajan
2006-06-02 21:38 ` Taco Hoekwater
2006-06-03  0:00   ` Hans Hagen

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