%%% Reversing text in 36 bytes (can you do better?) % Jan Šustek presented a pearl titled ``Reversing text in 55 bytes'' the % previous year. It comprised the following macro for sending puzzle % messages via SMS: \def\##1{\ifx.#1\def\#{~.}\else\edef~{#1~}\fi\#}\def~{}\#dlrow\ olleH. % Since length counts in text messages we propose the following version, % which is only 36 bytes (if we count the total length of the macro % definition and a call on ``Hello world.'' we get 70 bytes in Šustek’s % version and 51 in ours): \def~#1#2~{\ifx~#2~#1\else~#2~#1\fi}~.dlrow\ olleH~ % Let's trace the expansion of \verb|~|: % ~.dlrow\ olleH~ % ~dlrow\ olleH~. % ~lrow\ olleH~d. % ~row\ olleH~ld. % ~ow\ olleH~rld. % ~w\ olleH~orld. % ~\ olleH~world. % ~olleH~\ world. % ~lleH~o\ world. % ~leH~lo\ world. % ~eH~llo\ world. % ~H~ello\ world. % Hello\ world. % The beauty of this macro lies in symmetry: in the definition the % tokens between \verb|\ifx| and \verb|\else| are exactly the same as % tokens between \verb|\else| and \verb|\fi|. % Can you do any better? \end