ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* \getcommacommandsize not working in lmtx
@ 2022-05-02  7:37 Denis Maier via ntg-context
  2022-05-02  9:53 ` Hans Hagen via ntg-context
  0 siblings, 1 reply; 2+ messages in thread
From: Denis Maier via ntg-context @ 2022-05-02  7:37 UTC (permalink / raw)
  To: ntg-context; +Cc: denis.maier


[-- Attachment #1.1: Type: text/plain, Size: 568 bytes --]

Hi,

I've just ran into a behaviour that runs against what is shown on the wiki, https://wiki.contextgarden.net/System_Macros/Comma_Separated_Lists
Maybe a bug?

The wiki says you can use \getcommacommandsize to get the length of a comma separated list, but it does not seem to work. MWE below.

Best,
Denis


\define\somelist
  {foo, bar, baz}

\starttext

\getcommacommandsize[\somelist]
\commalistsize
% Expected : 3
% Actual : 1

\expandafter\getcommalistsize\expandafter[\somelist]
\commalistsize
% Expected : 3
% Actual : 3

\stoptext

[-- Attachment #1.2: Type: text/html, Size: 3381 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: \getcommacommandsize not working in lmtx
  2022-05-02  7:37 \getcommacommandsize not working in lmtx Denis Maier via ntg-context
@ 2022-05-02  9:53 ` Hans Hagen via ntg-context
  0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen via ntg-context @ 2022-05-02  9:53 UTC (permalink / raw)
  To: Denis Maier via ntg-context; +Cc: Hans Hagen

On 5/2/2022 9:37 AM, Denis Maier via ntg-context wrote:
> Hi,
> 
> I’ve just ran into a behaviour that runs against what is shown on the 
> wiki, https://wiki.contextgarden.net/System_Macros/Comma_Separated_Lists 
> <https://wiki.contextgarden.net/System_Macros/Comma_Separated_Lists>
> 
> Maybe a bug?

More a feature as \define defines a protected macro.

\starttext

\define\somelist{foo,bar,baz}

{\tt\meaningasis\somelist}

\getcommacommandsize[\somelist] \commalistsize

\defineexpandable\somelist{foo,bar,baz}

{\tt\meaningasis\somelist}

\getcommacommandsize[\somelist] \commalistsize

\starttexdefinition protected somelist
     foo,
     bar,
     baz
\stoptexdefinition

{\tt\meaningasis\somelist}

\getcommacommandsize[\somelist] \commalistsize

\starttexdefinition somelist
     foo,
     bar,
     baz
\stoptexdefinition

{\tt\meaningasis\somelist}

\getcommacommandsize[\somelist] \commalistsize

\semiprotected\def\somelist{foo,bar,baz}

\getcommacommandsize[\somelist] \commalistsize
\getcommacommandsize[\semiexpanded{\somelist}] \commalistsize

% also in next version:
%
% \starttexdefinition semiprotected somelist
%     foo,
%     bar,
%     baz
% \stoptexdefinition
%
% {\tt\meaningasis\somelist}
%
% \getcommacommandsize[\somelist] \commalistsize
% \getcommacommandsize[\semiexpanded{\somelist}] \commalistsize

\stoptext

The semiprotected is something lmtx and only expands when explicitly 
asked for (like in an \edef or so). Something that we might apply in the 
core some day.

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2022-05-02  9:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-02  7:37 \getcommacommandsize not working in lmtx Denis Maier via ntg-context
2022-05-02  9:53 ` Hans Hagen via ntg-context

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