blob: 42b0ac84325dadf847c33bebab8d5cbdc9c2d91b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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}
|