Created
October 18, 2018 10:13
-
-
Save wtsnjp/06018d0a9c5c91d50da3df2566b3add5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% plain TeX | |
\catcode`@=11 | |
\def\EvenOrOdd#1{\x@even@or@odd\empty #1\@nil} | |
\def\x@even@or@odd#1#2{% | |
\ifx#2\@nil | |
\x@hop@else\x@@even@or@odd #11\relax | |
\else | |
\x@hop@fi\x@even@or@odd{#1-}% | |
\fi} | |
\def\x@@even@or@odd#1\relax{\ifnum#1>\z@\expandafter E\else\expandafter O\fi} | |
\def\x@hop@else#1\else#2\fi{\fi #1} | |
\def\x@hop@fi#1\fi{\fi #1} | |
\edef\testA{\EvenOrOdd{a}:\EvenOrOdd{aa}:\EvenOrOdd{aaa}} | |
\expandafter\def\expandafter\testB\expandafter{% | |
\romannumeral-`>\EvenOrOdd{aaaa}} | |
\message{^^JTEST A: \meaning\testA} | |
\message{^^JTEST B: \meaning\testB} | |
\bye | |
% vim: ft=plaintex: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment