summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/lisp-on-tex/examples
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-03-05 00:33:46 +0000
committerKarl Berry <karl@freefriends.org>2013-03-05 00:33:46 +0000
commitd472c7d8c47d5a08e34a9f4713164afc5e7a1406 (patch)
tree4249b1eff690be906945d15b1e39e33037b1abdc /Master/texmf-dist/doc/latex/lisp-on-tex/examples
parent0d0778a39975e8293bde2267504f53bd9d3610a6 (diff)
lisp-on-tex (4mar13)
git-svn-id: svn://tug.org/texlive/trunk@29291 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/lisp-on-tex/examples')
-rw-r--r--Master/texmf-dist/doc/latex/lisp-on-tex/examples/fact.pdfbin0 -> 36635 bytes
-rw-r--r--Master/texmf-dist/doc/latex/lisp-on-tex/examples/fact.tex30
-rw-r--r--Master/texmf-dist/doc/latex/lisp-on-tex/examples/fpnummodule-mandelbrot.pdfbin0 -> 32298 bytes
-rw-r--r--Master/texmf-dist/doc/latex/lisp-on-tex/examples/fpnummodule-mandelbrot.tex55
-rw-r--r--Master/texmf-dist/doc/latex/lisp-on-tex/examples/rocket.pdfbin0 -> 30978 bytes
-rw-r--r--Master/texmf-dist/doc/latex/lisp-on-tex/examples/rocket.tex26
6 files changed, 111 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/examples/fact.pdf b/Master/texmf-dist/doc/latex/lisp-on-tex/examples/fact.pdf
new file mode 100644
index 00000000000..bef54e029ca
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/lisp-on-tex/examples/fact.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/examples/fact.tex b/Master/texmf-dist/doc/latex/lisp-on-tex/examples/fact.tex
new file mode 100644
index 00000000000..39fb7eeb116
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/lisp-on-tex/examples/fact.tex
@@ -0,0 +1,30 @@
+\documentclass{article}
+\usepackage{lisp-on-tex}
+\lispinterp{%
+ (\define \sq (\lambda (\n) (\* \n \n)))
+ (\define \fact (\lambda (\n) (\lispif (\= \n :0) :1 (\* \n (\fact (\- \n :1))))))
+ }
+\newcommand\sq[1]{\lispinterp{(\texprint (\sq :#1))}}
+\newcommand\fact[1]{\lispinterp{(\texprint (\fact :#1))}}
+
+\begin{document}
+\section{Factorials and Squares}
+ \begin{center}
+ \begin{tabular}{r||rr}\hline\hline
+ $n$ & $n!$ & $n^2$ \\
+ \hline
+ 1 & \fact{1} & \sq{1} \\
+ 2 & \fact{2} & \sq{2} \\
+ 3 & \fact{3} & \sq{3} \\
+ 4 & \fact{4} & \sq{4} \\
+ 5 & \fact{5} & \sq{5} \\
+ 6 & \fact{6} & \sq{6} \\
+ 7 & \fact{7} & \sq{7} \\
+ 8 & \fact{8} & \sq{8} \\
+ 9 & \fact{9} & \sq{9} \\
+ 10 & \fact{10} & \sq{10} \\
+ 11 & \fact{11} & \sq{11} \\
+ \hline
+ \end{tabular}
+ \end{center}
+\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/examples/fpnummodule-mandelbrot.pdf b/Master/texmf-dist/doc/latex/lisp-on-tex/examples/fpnummodule-mandelbrot.pdf
new file mode 100644
index 00000000000..fc227eccc5d
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/lisp-on-tex/examples/fpnummodule-mandelbrot.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/examples/fpnummodule-mandelbrot.tex b/Master/texmf-dist/doc/latex/lisp-on-tex/examples/fpnummodule-mandelbrot.tex
new file mode 100644
index 00000000000..f0cf68798b5
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/lisp-on-tex/examples/fpnummodule-mandelbrot.tex
@@ -0,0 +1,55 @@
+\documentclass{article}
+\usepackage[pdftex,a3paper,margin=1pt,landscape]{geometry}
+\newcount\mlength
+\newcount\cstate
+\newdimen\mandelunit
+\mandelunit=0.5pt
+
+\def\w{%
+ \ifnum\cstate=1 \global\advance\mlength1
+ \else \vrule width \mlength\mandelunit height \mandelunit depth 0pt \global\mlength1 \fi
+ \global\cstate1}
+\def\b{%
+ \ifnum\cstate=-1 \global\advance\mlength1
+ \else \hspace*{\mlength\mandelunit}\global\mlength1 \fi
+ \global\cstate-1}
+\def\r{%
+ \ifnum\cstate=1\hspace*{\mlength\mandelunit}\else\vrule width \mlength\mandelunit height \mandelunit depth 0pt \fi
+ \global\cstate0 \global\mlength0}
+
+\usepackage{lisp-on-tex}
+\usepackage{lisp-mod-fpnum}
+\lispinterp{%
+ (\define \maxloop :20)
+ (\define \scale +{fpnum::0.002})
+ (\define \isMandell
+ (\lambda (\a \b \k \x \y)
+ (\lispif (\< \maxloop \k) /t
+ (\lispif (\fplt +{fpnum::4.0} (\fpplus (\fpmul \x \x) (\fpmul \y \y)))
+ /f
+ (\isMandell \a \b (\+ \k :1)
+ (\fpplus \a (\fpmul \x \x) (\fpminus (\fpmul \y \y)))
+ (\fpplus \b (\fpmul +{fpnum::2.0} \x \y)))))))
+ (\define \drawMandell (\lambda (\a \b)
+ (\begin
+ (\lispif (\isMandell \a \b :0 +{fpnum::0} +{fpnum::0})
+ (\texprint '\b') (\texprint '\w'))
+ (\immediatewrite))))
+ (\define \loopMandell (\lambda (\a \b)
+ (\lispif (\fplt \b +{fpnum::-1.0}) ()
+ (\begin
+ (\drawMandell \a \b)
+ (\lispif (\fplt +{fpnum::0.5} \a)
+ (\begin
+ (\texprint '\r\\')
+ (\immediatewrite)
+ (\loopMandell +{fpnum::-1.5} (\fpminus \b \scale)))
+ (\loopMandell (\fpplus \a \scale) \b))))))
+}
+
+\begin{document}
+ \thispagestyle{empty}
+ \noindent
+ \leavevmode\baselineskip=\mandelunit
+ \lispinterp{(\loopMandell +{fpnum::-1.5} +{fpnum::1.0})}
+\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/examples/rocket.pdf b/Master/texmf-dist/doc/latex/lisp-on-tex/examples/rocket.pdf
new file mode 100644
index 00000000000..482cb62993b
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/lisp-on-tex/examples/rocket.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/examples/rocket.tex b/Master/texmf-dist/doc/latex/lisp-on-tex/examples/rocket.tex
new file mode 100644
index 00000000000..c4ed29648fd
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/lisp-on-tex/examples/rocket.tex
@@ -0,0 +1,26 @@
+\documentclass{article}
+\usepackage{lisp-on-tex}
+\lispinterp{%
+%rocket body
+(\define \rocket
+ (\letM ((\count :11))
+ (\lambda ()
+ (\begin
+ (\setB \count (\- \count :1))
+ (\lispif (\< \count :0)
+ (\texprint '{\small fired...}\\')
+ (\lispif (\= \count :0)
+ (\texprint '{\Large FIRE!}\\')
+ (\texprint (\concat 'count ' (\intTOstring \count) '...\\'))))))))
+(\define \MAX :15)
+%LOOP function
+(\define \loop
+ (\lambda (\n)
+ (\lispif (\= \n \MAX)
+ ()
+ (\begin (\rocket) (\loop (\+ \n :1))))))
+}
+\begin{document}
+\noindent\lispinterp{(\loop :0)}
+Test done.
+\end{document} \ No newline at end of file