Skip to content

Instantly share code, notes, and snippets.

@kmaed
Created October 13, 2012 17:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmaed/3885495 to your computer and use it in GitHub Desktop.
Save kmaed/3885495 to your computer and use it in GitHub Desktop.
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
Copy link
Author

kmaed commented Oct 13, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment