| 1 |
\documentclass{article} |
| 2 |
%\usepackage{lisp-on-tex} |
| 3 |
\usepackage[markGC]{lisp-on-tex} |
| 4 |
\lispinterp { |
| 5 |
(\define (\create \n) (\createAcc \n ())) |
| 6 |
(\define (\createAcc \n \acc) |
| 7 |
(\lispif (\= \n :0) \acc (\createAcc (\- \n :1) (\cons () \acc)))) |
| 8 |
(\define \ll (\create :200)) |
| 9 |
(\define (\divII \l) |
| 10 |
(\lispif (\= \l ()) () (\cons (\car \l) (\divII (\cdr (\cdr \l)))))) |
| 11 |
(\define (\test \l) (\testAcc \l :500)) % original is 300 |
| 12 |
(\define (\testAcc \l \i) |
| 13 |
(\lispif (\= \i :0) () |
| 14 |
(\begin |
| 15 |
(\lispif (\= (\length (\divII \l)) :100) |
| 16 |
() (\texprint 'Hmm')) |
| 17 |
(\lispif (\= (\length (\divII \l)) :100) |
| 18 |
() (\message 'Hmm')) |
| 19 |
(\lispif (\= (\length (\divII \l)) :100) |
| 20 |
() (\message 'Hmm')) |
| 21 |
(\lispif (\= (\length (\divII \l)) :100) |
| 22 |
() (\message 'Hmm')) |
| 23 |
(\texprint \i) |
| 24 |
(\texprint ' ') |
| 25 |
(\testAcc \l (\- \i :1))))) |
| 26 |
} |
| 27 |
|
| 28 |
\begin{document} |
| 29 |
\lispinterp{(\test \ll)} |
| 30 |
\end{document} |