diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/perltex/tarai.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/perltex/tarai.tex | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/perltex/tarai.tex b/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/perltex/tarai.tex new file mode 100644 index 00000000000..7ee739bbb9d --- /dev/null +++ b/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/perltex/tarai.tex @@ -0,0 +1,15 @@ +\documentclass{article} +\usepackage{perltex} +\perlnewcommand{\tarai}[3]{ + if($_[0] <= $_[1]){ + return $_[1]; + } else { + return latex_tarai( + latex_tarai($_[0]-1, $_[1], $_[2]), + latex_tarai($_[1]-1, $_[2], $_[0]), + latex_tarai($_[2]-1, $_[0], $_[1])); + } +} +\begin{document} + $\mathrm{Tarai}(14,10,6) = \tarai{14}{10}{6}$ +\end{document}
\ No newline at end of file |