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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
\begin{patch}{OneDimensionalArrayXmpPagePatch1}
\begin{paste}{OneDimensionalArrayXmpPageFull1}{OneDimensionalArrayXmpPageEmpty1}
\pastebutton{OneDimensionalArrayXmpPageFull1}{\hidepaste}
\tab{5}\spadcommand{oneDimensionalArray [i**2 for i in 1..10]}
\indentrel{3}\begin{verbatim}
(1) [1,4,9,16,25,36,49,64,81,100]
Type: OneDimensionalArray PositiveInteger
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}
\begin{patch}{OneDimensionalArrayXmpPageEmpty1}
\begin{paste}{OneDimensionalArrayXmpPageEmpty1}{OneDimensionalArrayXmpPagePatch1}
\pastebutton{OneDimensionalArrayXmpPageEmpty1}{\showpaste}
\tab{5}\spadcommand{oneDimensionalArray [i**2 for i in 1..10]}
\end{paste}\end{patch}
\begin{patch}{OneDimensionalArrayXmpPagePatch2}
\begin{paste}{OneDimensionalArrayXmpPageFull2}{OneDimensionalArrayXmpPageEmpty2}
\pastebutton{OneDimensionalArrayXmpPageFull2}{\hidepaste}
\tab{5}\spadcommand{a : ARRAY1 INT := new(10,0)\bound{a }}
\indentrel{3}\begin{verbatim}
(2) [0,0,0,0,0,0,0,0,0,0]
Type: OneDimensionalArray Integer
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}
\begin{patch}{OneDimensionalArrayXmpPageEmpty2}
\begin{paste}{OneDimensionalArrayXmpPageEmpty2}{OneDimensionalArrayXmpPagePatch2}
\pastebutton{OneDimensionalArrayXmpPageEmpty2}{\showpaste}
\tab{5}\spadcommand{a : ARRAY1 INT := new(10,0)\bound{a }}
\end{paste}\end{patch}
\begin{patch}{OneDimensionalArrayXmpPagePatch3}
\begin{paste}{OneDimensionalArrayXmpPageFull3}{OneDimensionalArrayXmpPageEmpty3}
\pastebutton{OneDimensionalArrayXmpPageFull3}{\hidepaste}
\tab{5}\spadcommand{for i in 1..10 repeat a.i := i; a\bound{a1 }\free{a }}
\indentrel{3}\begin{verbatim}
(3) [1,2,3,4,5,6,7,8,9,10]
Type: OneDimensionalArray Integer
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}
\begin{patch}{OneDimensionalArrayXmpPageEmpty3}
\begin{paste}{OneDimensionalArrayXmpPageEmpty3}{OneDimensionalArrayXmpPagePatch3}
\pastebutton{OneDimensionalArrayXmpPageEmpty3}{\showpaste}
\tab{5}\spadcommand{for i in 1..10 repeat a.i := i; a\bound{a1 }\free{a }}
\end{paste}\end{patch}
\begin{patch}{OneDimensionalArrayXmpPagePatch4}
\begin{paste}{OneDimensionalArrayXmpPageFull4}{OneDimensionalArrayXmpPageEmpty4}
\pastebutton{OneDimensionalArrayXmpPageFull4}{\hidepaste}
\tab{5}\spadcommand{map!(i +-> i ** 2,a); a\bound{a3 }\free{a2 }}
\indentrel{3}\begin{verbatim}
(4) [1,4,9,16,25,36,49,64,81,100]
Type: OneDimensionalArray Integer
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}
\begin{patch}{OneDimensionalArrayXmpPageEmpty4}
\begin{paste}{OneDimensionalArrayXmpPageEmpty4}{OneDimensionalArrayXmpPagePatch4}
\pastebutton{OneDimensionalArrayXmpPageEmpty4}{\showpaste}
\tab{5}\spadcommand{map!(i +-> i ** 2,a); a\bound{a3 }\free{a2 }}
\end{paste}\end{patch}
\begin{patch}{OneDimensionalArrayXmpPagePatch5}
\begin{paste}{OneDimensionalArrayXmpPageFull5}{OneDimensionalArrayXmpPageEmpty5}
\pastebutton{OneDimensionalArrayXmpPageFull5}{\hidepaste}
\tab{5}\spadcommand{reverse! a\bound{a4 }\free{a3 }}
\indentrel{3}\begin{verbatim}
(5) [100,81,64,49,36,25,16,9,4,1]
Type: OneDimensionalArray Integer
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}
\begin{patch}{OneDimensionalArrayXmpPageEmpty5}
\begin{paste}{OneDimensionalArrayXmpPageEmpty5}{OneDimensionalArrayXmpPagePatch5}
\pastebutton{OneDimensionalArrayXmpPageEmpty5}{\showpaste}
\tab{5}\spadcommand{reverse! a\bound{a4 }\free{a3 }}
\end{paste}\end{patch}
\begin{patch}{OneDimensionalArrayXmpPagePatch6}
\begin{paste}{OneDimensionalArrayXmpPageFull6}{OneDimensionalArrayXmpPageEmpty6}
\pastebutton{OneDimensionalArrayXmpPageFull6}{\hidepaste}
\tab{5}\spadcommand{swap!(a,4,5); a\bound{a5 }\free{a4 }}
\indentrel{3}\begin{verbatim}
(6) [100,81,64,36,49,25,16,9,4,1]
Type: OneDimensionalArray Integer
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}
\begin{patch}{OneDimensionalArrayXmpPageEmpty6}
\begin{paste}{OneDimensionalArrayXmpPageEmpty6}{OneDimensionalArrayXmpPagePatch6}
\pastebutton{OneDimensionalArrayXmpPageEmpty6}{\showpaste}
\tab{5}\spadcommand{swap!(a,4,5); a\bound{a5 }\free{a4 }}
\end{paste}\end{patch}
\begin{patch}{OneDimensionalArrayXmpPagePatch7}
\begin{paste}{OneDimensionalArrayXmpPageFull7}{OneDimensionalArrayXmpPageEmpty7}
\pastebutton{OneDimensionalArrayXmpPageFull7}{\hidepaste}
\tab{5}\spadcommand{sort! a\bound{a6 }\free{a5 }}
\indentrel{3}\begin{verbatim}
(7) [1,4,9,16,25,36,49,64,81,100]
Type: OneDimensionalArray Integer
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}
\begin{patch}{OneDimensionalArrayXmpPageEmpty7}
\begin{paste}{OneDimensionalArrayXmpPageEmpty7}{OneDimensionalArrayXmpPagePatch7}
\pastebutton{OneDimensionalArrayXmpPageEmpty7}{\showpaste}
\tab{5}\spadcommand{sort! a\bound{a6 }\free{a5 }}
\end{paste}\end{patch}
\begin{patch}{OneDimensionalArrayXmpPagePatch8}
\begin{paste}{OneDimensionalArrayXmpPageFull8}{OneDimensionalArrayXmpPageEmpty8}
\pastebutton{OneDimensionalArrayXmpPageFull8}{\hidepaste}
\tab{5}\spadcommand{b := a(6..10)\bound{b }\free{a6 }}
\indentrel{3}\begin{verbatim}
(8) [36,49,64,81,100]
Type: OneDimensionalArray Integer
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}
\begin{patch}{OneDimensionalArrayXmpPageEmpty8}
\begin{paste}{OneDimensionalArrayXmpPageEmpty8}{OneDimensionalArrayXmpPagePatch8}
\pastebutton{OneDimensionalArrayXmpPageEmpty8}{\showpaste}
\tab{5}\spadcommand{b := a(6..10)\bound{b }\free{a6 }}
\end{paste}\end{patch}
\begin{patch}{OneDimensionalArrayXmpPagePatch9}
\begin{paste}{OneDimensionalArrayXmpPageFull9}{OneDimensionalArrayXmpPageEmpty9}
\pastebutton{OneDimensionalArrayXmpPageFull9}{\hidepaste}
\tab{5}\spadcommand{copyInto!(a,b,1)\free{b }}
\indentrel{3}\begin{verbatim}
(9) [36,49,64,81,100,36,49,64,81,100]
Type: OneDimensionalArray Integer
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}
\begin{patch}{OneDimensionalArrayXmpPageEmpty9}
\begin{paste}{OneDimensionalArrayXmpPageEmpty9}{OneDimensionalArrayXmpPagePatch9}
\pastebutton{OneDimensionalArrayXmpPageEmpty9}{\showpaste}
\tab{5}\spadcommand{copyInto!(a,b,1)\free{b }}
\end{paste}\end{patch}
|