I don't understand an example from section 6.1 of expl3-intro.tex from LATEX3 documentation. It is said there:
Here are two equivalent ways of defining the function
\foo:nn:\cs_set:Npn \foo:nn #1#2 {(#1)/(#2)} \cs_set:cpn {foo:nn} #1#2 {(#1)/(#2)}These macros are respectively equivalent to \TeX's
\long\def\foo:nn, and
\expandafter\long\expandafter\def\csname foo:nn\endcsname.
Note the
:nnsuffix to denote that |\foo| takes two arguments.
Given equivalents seem to be reduced rather than complete. Could somebody provide accurate equivalents of
\cs_set:Npn \foo:nn #1#2 {(#1)/(#2)}
and
\cs_set:cpn {foo:nn} #1#2 {(#1)/(#2)}
?
In particular, I wonder at \long\def\foo:nn. Is colon allowed in command names in Plain TeX or LaTeX 2e? Is it assumed here that catcode of : has been changed? If so, corresponding commands are suggested to be explicitly added to the above example. And where is the expanded part of definitions (i.e. {(#1)/(#2)})?
\long\defshould be prepended with\catcode`:=11and\catcode`_=11. – Igor Kotelnikov Nov 24 '11 at 08:49\makeatletter". – Joseph Wright Nov 24 '11 at 08:56\ExplSyntaxOn/Offis the expl3 analogue to\makeatletter/other. Catcode assignments aren't required :) (I say this here because I've seen it and they cited this Q.) – Sean Allred May 18 '15 at 18:43