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 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218
|
# Lists
These tests are taken from the examples
## average - Compute the mean and standard deviation of a list
Task average computes the average and standard deviation of a list of
numbers.
File: `numbers`
```
0.7087
0.425
0.9906
0.5149
0.4219
0.6486
0.7075
0.8334
```
```
cl> type numbers | average
0.656325 0.19892008266064 8
cl> print 1 | average add
0.69451111111111 0.21851009384262 9
```
## columns - Convert multicolumn file to separate files
Task columns is used to reformat a multicolumn list file into separate
files, such that one output file is created for each column in the
input file.
File: `dtable`
```
0.7087 0.425 0.9906
0.5149 0.4219 0.6486
0.7075 0.8334 0.8039
0.571 0.6779 0.3024
0.6091 0.4976 0.5332
0.3596 0.1426 0.3051
0.4146 0.5085 0.0547
0.4568 0.1392 0.3042
0.1508 0.4498 0.7418
```
```
cl> columns dtable 3 outroot=datacol.
cl> type datacol.1
0.7087
0.5149
0.7075
0.571
0.6091
0.3596
0.4146
0.4568
0.1508
cl> type datacol.2
0.425
0.4219
0.8334
0.6779
0.4976
0.1426
0.5085
0.1392
0.4498
cl> type datacol.3
0.9906
0.6486
0.8039
0.3024
0.5332
0.3051
0.0547
0.3042
0.7418
```
## lintran - Perform linear transformation of a list
Specified fields from the input list can be scaled, rotated and
shifted.
File: `frame1`
```
0.7087 0.424
0.9906 0.5149
0.4219 0.6486
0.7075 0.8334
0.8039 0.571
0.6779 0.3024
0.6091 0.4976
0.5332 0.3596
```
```
cl> lintran frame1 x1=35.7 y1=389.2 x2=36.9 y2=400.0
1.9087 11.22
2.1906 11.315
1.6219 11.449
1.9075 11.633
2.0039 11.37
1.8779 11.102
1.8091 11.298
1.7332 11.16
cl> lintran frame1 angle=90
-0.424 0.7087
-0.515 0.9906
-0.649 0.4219
-0.833 0.7075
-0.571 0.8039
-0.302 0.6779
-0.498 0.6091
-0.36 0.5332
```
## table - Format a list of words into a table
Task table reads a list of strings from the standard input or a list
of files and assembles a nicely formatted table.
```
cl> sort numbers numeric_sort=yes | table ncol=2 first_col=1 last_col=20
0.4219 0.7075
0.425 0.7087
0.5149 0.8334
0.6486 0.9906
```
## tokens - Break a file up into a stream of tokens
Task tokens breaks the input up into a series of tokens.
File: `hello.x`
```
# HELLO -- Sample program introducing SPP.
procedure t_hello_world ()
begin
call printf ("Hello,world!")
end
```
```
cl> tokens hello.x newline=no
procedure
t_hello_world
(
)
begin
call
printf
(
"Hello,world!"
)
end
```
## unique - Delete redundant elements from a list
Task unique reads the input comparing adjacent lines. The second and
successive copies of a line are removed; the remainder is passed on to
the standard output.
File: `names`
```
what
is
important
about
object
is
something
```
```
cl> sort names | unique
about
important
is
object
something
what
```
## words - Break a file up into a stream of words
Task words is used to break the input up into a series of words or
strings.
File: `text`
```
Task words is used to break the input up into a series of words or
strings.
```
```
cl> words text
Task
words
is
used
to
break
the
input
up
into
a
series
of
words
or
strings.
```
|