all tasks

This commit is contained in:
Ingy döt Net 2013-04-11 01:07:29 -07:00
parent b83f433714
commit 68f8f3e56b
14735 changed files with 178959 additions and 0 deletions

View file

@ -0,0 +1,22 @@
my $fields = 49;
my ($good-records, %dates) = 0;
for 1 .. * Z $*IN.lines -> $line, $s {
my @fs = split /\s+/, $s;
@fs == $fields or die "$line: Bad number of fields";
given shift @fs {
m/\d**4 \- \d**2 \- \d**2/ or die "$line: Bad date format";
++%dates{$_};
}
my $all-flags-okay = True;
for @fs -> $val, $flag {
$val ~~ /\d+ \. \d+/ or die "$line: Bad value format";
$flag ~~ /^ \-? \d+/ or die "$line: Bad flag format";
$flag < 1 and $all-flags-okay = False;
}
$all-flags-okay and ++$good-records;
}
say 'Good records: ', $good-records;
say 'Repeated timestamps:';
say ' ', $_ for grep { %dates{$_} > 1 }, sort keys %dates;

View file

@ -0,0 +1,19 @@
my $good-records;
my $line;
my %dates;
for lines() {
$line++;
/ ^
(\d ** 4 '-' \d\d '-' \d\d)
[ \h+ \d+'.'\d+ \h+ ('-'?\d+) ] ** 24
$ /
or note "Bad format at line $line" and next;
%dates.push: $0 => $line;
$good-records++ if $1.all >= 1;
}
say "$good-records good records out of $line total";
say 'Repeated timestamps (with line numbers):';
.say for sort %dates.pairs.grep: *.value.elems > 1;