Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
53
Task/Text-processing-2/Aime/text-processing-2.aime
Normal file
53
Task/Text-processing-2/Aime/text-processing-2.aime
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
check_format(list l)
|
||||
{
|
||||
integer i;
|
||||
text s;
|
||||
|
||||
if (~l != 49) {
|
||||
error("bad field count");
|
||||
}
|
||||
|
||||
s = l[0];
|
||||
if (match("????-??-??", s)) {
|
||||
error("bad date format");
|
||||
}
|
||||
l[0] = s.delete(7).delete(4).atoi;
|
||||
|
||||
i = 1;
|
||||
while (i < 49) {
|
||||
atof(l[i]);
|
||||
i += 1;
|
||||
l[i >> 1] = atoi(l[i]);
|
||||
i += 1;
|
||||
}
|
||||
|
||||
l.erase(25, -1);
|
||||
}
|
||||
|
||||
main(void)
|
||||
{
|
||||
integer goods, i, v;
|
||||
file f;
|
||||
list l;
|
||||
index x;
|
||||
|
||||
goods = 0;
|
||||
|
||||
f.affix("readings.txt");
|
||||
|
||||
while (f.list(l, 0) != -1) {
|
||||
if (!trap(check_format, l)) {
|
||||
if ((x[v = lf_x_integer(l)] += 1) != 1) {
|
||||
v_form("duplicate ~ line\n", v);
|
||||
}
|
||||
|
||||
i = 1;
|
||||
l.ucall(min_i, 1, i);
|
||||
goods += iclip(0, i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
o_(goods, " good lines\n");
|
||||
|
||||
0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue