Created
December 6, 2018 09:27
-
-
Save wtsnjp/7f39a913d091b52e6e2df2d1f32d43c3 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
\documentclass{article} | |
\usepackage{expl3} | |
\ExplSyntaxOn | |
% \my_ack:nn { <m> } { <n> } | |
\cs_new:Npn \my_ack:nn #1#2 | |
{ | |
\int_compare:nNnTF { #1 } = { \c_zero_int } | |
{ % m = 0 | |
\int_eval:n { #2 + 1 } | |
} | |
{ | |
\int_compare:nNnTF { #2 } = { \c_zero_int } | |
{ % n = 0 | |
\my_ack:ff { #1 - 1 } { \c_one_int } | |
} | |
{ % otherwise | |
\my_ack:ff { #1 - 1 } { \my_ack:ff { #1 } { #2 - 1 } } | |
} | |
} | |
} | |
\cs_generate_variant:Nn \my_ack:nn { ff } | |
\cs_new_eq:NN \Ack \my_ack:ff | |
\ExplSyntaxOff | |
\begin{document} | |
\[ | |
\mathrm{Ack}(1, 2) = \Ack{1}{2} | |
\] | |
\end{document} | |
% vim: ft=expl3: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment