Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
2012/10/13 の解答
\catcode`\@=11
\def\letargswapped#1#2{%
\edef\def@macroB{\def\noexpand#1####1####2{\expandafter\unexpanded\expandafter{#2{##2}{##1}}}}%
\def@macroB}
\catcode`\@=12
\def\Frac#1#2{{#1\over#2}}
\letargswapped\RFrac\Frac
$$\RFrac{13}{42}$$ %==>分数「13分の42」が出力される
\edef\hogeA#1#2{#1\string~#2\noexpand~}
\letargswapped\hogeB\hogeA
\expandafter\def\expandafter\expA\expandafter{\hogeA^?}
\expandafter\def\expandafter\expB\expandafter{\hogeB?^}
% \expA も \expB も ^[7]~[12]?[12]~[13] となるはず
\ifx\expA\expB\else\errmessage{Oops}\fi %==> エラーなし
\bye
@kmaed

This comment has been minimized.

Copy link
Owner Author

kmaed commented Oct 13, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.