| 1 |
\documentclass{article} |
| 2 |
\usepackage{lisp-on-tex} |
| 3 |
\lispinterp{% |
| 4 |
%rocket body |
| 5 |
(\define \rocket |
| 6 |
(\letM ((\count :11)) |
| 7 |
(\lambda () |
| 8 |
(\begin |
| 9 |
(\setB \count (\- \count :1)) |
| 10 |
(\lispif (\< \count :0) |
| 11 |
(\texprint '{\small fired...}\\') |
| 12 |
(\lispif (\= \count :0) |
| 13 |
(\texprint '{\Large FIRE!}\\') |
| 14 |
(\texprint (\concat 'count ' (\intTOstring \count) '...\\')))))))) |
| 15 |
(\define \MAX :15) |
| 16 |
%LOOP function |
| 17 |
(\define \loop |
| 18 |
(\lambda (\n) |
| 19 |
(\lispif (\= \n \MAX) |
| 20 |
() |
| 21 |
(\begin (\rocket) (\loop (\+ \n :1)))))) |
| 22 |
} |
| 23 |
\begin{document} |
| 24 |
\noindent\lispinterp{(\loop :0)} |
| 25 |
Test done. |
| 26 |
\end{document} |