aboutsummaryrefslogtreecommitdiff
path: root/src/input/loop.input.pamphlet
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2007-08-14 05:14:52 +0000
committerdos-reis <gdr@axiomatics.org>2007-08-14 05:14:52 +0000
commitab8cc85adde879fb963c94d15675783f2cf4b183 (patch)
treec202482327f474583b750b2c45dedfc4e4312b1d /src/input/loop.input.pamphlet
downloadopen-axiom-ab8cc85adde879fb963c94d15675783f2cf4b183.tar.gz
Initial population.
Diffstat (limited to 'src/input/loop.input.pamphlet')
-rw-r--r--src/input/loop.input.pamphlet59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/input/loop.input.pamphlet b/src/input/loop.input.pamphlet
new file mode 100644
index 00000000..42b0ac84
--- /dev/null
+++ b/src/input/loop.input.pamphlet
@@ -0,0 +1,59 @@
+\documentclass{article}
+\usepackage{axiom}
+\begin{document}
+\title{\$SPAD/src/input loop.input}
+\author{The Axiom Team}
+\maketitle
+\begin{abstract}
+\end{abstract}
+\eject
+\tableofcontents
+\eject
+<<*>>=
+
+-- Input for page BasicLoops
+)clear all
+
+p := 2**(2**3) + 1
+repeat if prime?(p := p + 1) then leave
+p
+repeat if prime?(p := p + 1) then leave p
+
+-- Input for page NestedLoops
+)clear all
+
+for i in 1..2 repeat for j in 3..4 repeat print [i,j]
+i := 1
+while i < 3 repeat (for j in 3..4 repeat print [i,j]; i := i + 1)
+
+-- Input for page ParallelLoops
+)clear all
+
+for i in 1..5 for j in 11..20 repeat print [i,j]
+for i in 1..5 for j in 11.. | even? j repeat print [i,j]
+for i in 1.. for j in 11.. | even? j while i < 6 repeat print [i,j]
+
+-- Input for page Loops
+)clear all
+
+i := 2
+repeat (print (i := 2**i; if i > 10 then leave))
+for j in 1..5 repeat print (i := j**i)
+while i < 1000 repeat print (i := 2**i)
+for i in 1.. while i < 1000 repeat print [j,": ",i := 2**i]
+for j in 1..4 repeat for i in 2..4 repeat print [i,"**",j," = ",i**j]
+
+-- Input for page ForLoops
+)clear all
+
+for i in 0..10 repeat print (i**3)
+for i in 0..10 by 2 repeat print (i**3)
+for i in 10..0 by -2 repeat print (i**3)
+for i in 0..10 | even? i repeat print (i**3)
+for i in 0.. by 2 repeat (i**3)
+@
+\eject
+\begin{thebibliography}{99}
+\bibitem{1} nothing
+\end{thebibliography}
+\end{document}