-
-
Save cjepeway/42215154aff709d3efd7 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl6 | |
constant RAKUDO-SRC = '/home/jepeway/src/tz/rakudo-fork'; | |
#say "[working]"; | |
for lines() { | |
#say "checking [$_]"; | |
.say; | |
next unless m{(<[ . , ; \w \d / \- + @ ]>*) ':' (.*)}; | |
my ($file, $lineno) = ($0, $1); | |
$file = RAKUDO-SRC ~ '/' ~ $file | |
unless $file.IO.e; | |
next unless $file.IO.e; | |
#say "$file:$lineno"; | |
my $fh = open $file; | |
my $n = 0; | |
for $fh.lines() { | |
next unless ++$n == $lineno; | |
"• $_".say; | |
last | |
} | |
$fh.close(); | |
} |
jepeway@go-go-go:~/src/tz/p6$ make t/05-datetimex P6=/home/jepeway/src/tz/rakudo-fork/install/bin/perl6 | |
prove --nocolor -e '/home/jepeway/src/tz/rakudo-fork/install/bin/perl6 -I /home/jepeway/src/tz/p6' -v t/05-datetimex | |
t/05-datetimex .. | |
1..8 | |
ok 1 - UTC - seconds since posix epoch | |
not ok 2 - American/New_York - seconds since posix epoch | |
# Failed test 'American/New_York - seconds since posix epoch' | |
# at t/05-datetimex line 27 | |
# expected: '0' | |
# got: '3600' | |
abstract method unimplemented in subclass | |
in method utc-offset-in-seconds at /home/jepeway/src/tz/p6/TimeZone.pm:6 | |
in method posix at /home/jepeway/src/tz/p6/DateTimeX.pm:7 | |
in method in-timezone at /home/jepeway/src/tz/p6/DateTimeX.pm:42 | |
in method new at src/gen/m-CORE.setting:20304 | |
in method new at /home/jepeway/src/tz/p6/DateTimeX.pm:34 | |
in method later at src/gen/m-CORE.setting:20399 | |
in method earlier at src/gen/m-CORE.setting:20451 | |
in block <unit> at t/05-datetimex:39 | |
# Looks like you planned 8 tests, but ran 2 | |
# Looks like you failed 1 tests of 2 | |
Dubious, test returned 1 (wstat 256, 0x100) | |
Failed 7/8 subtests | |
Test Summary Report | |
------------------- | |
t/05-datetimex (Wstat: 256 Tests: 2 Failed: 1) | |
Failed test: 2 | |
Non-zero exit status: 1 | |
Parse errors: Bad plan. You planned 8 tests but ran 2. | |
Files=1, Tests=2, 0 wallclock secs ( 0.01 usr 0.00 sys + 0.57 cusr 0.00 csys = 0.58 CPU) | |
Result: FAIL | |
make: *** [t/05-datetimex] Error 1 |
jepeway@go-go-go:~/src/tz/p6$ bt < /tmp/z | |
jepeway@go-go-go:~/src/tz/p6$ make t/05-datetimex P6=/home/jepeway/src/tz/rakudo-fork/install/bin/perl6 | |
prove --nocolor -e '/home/jepeway/src/tz/rakudo-fork/install/bin/perl6 -I /home/jepeway/src/tz/p6' -v t/05-datetimex | |
t/05-datetimex .. | |
1..8 | |
ok 1 - UTC - seconds since posix epoch | |
not ok 2 - American/New_York - seconds since posix epoch | |
# Failed test 'American/New_York - seconds since posix epoch' | |
# at t/05-datetimex line 27 | |
# expected: '0' | |
# got: '3600' | |
abstract method unimplemented in subclass | |
in method utc-offset-in-seconds at /home/jepeway/src/tz/p6/TimeZone.pm:6 | |
• multi method utc-offset-in-seconds(DateTime $when) returns Int { self.unimplemented(&?ROUTINE); } | |
in method posix at /home/jepeway/src/tz/p6/DateTimeX.pm:7 | |
• method posix() { | |
in method in-timezone at /home/jepeway/src/tz/p6/DateTimeX.pm:42 | |
• my DateTime $dt .= new(self.posix, :timezone($tz.utc-offset-in-seconds(self))); | |
in method new at src/gen/m-CORE.setting:20304 | |
• self.bless(:$year, :$month, :$day, | |
in method new at /home/jepeway/src/tz/p6/DateTimeX.pm:34 | |
• my $dt = self.new: floor($p - $leap-second).Int, :&formatter, :$timezone; | |
in method later at src/gen/m-CORE.setting:20399 | |
• return self.new(self.Instant + $amount, :timezone($.timezone)); | |
in method earlier at src/gen/m-CORE.setting:20451 | |
• method earlier(*%unit) { | |
in block <unit> at t/05-datetimex:39 | |
• my $time-change-utc = DateTimeX.new(:year(2014), :month(3), :day(9), :hour(2), :minute(0), :second(0), :timezone(UTC-TZ.new())).earlier(seconds => $off); | |
# Looks like you planned 8 tests, but ran 2 | |
# Looks like you failed 1 tests of 2 | |
Dubious, test returned 1 (wstat 256, 0x100) | |
Failed 7/8 subtests | |
Test Summary Report | |
------------------- | |
t/05-datetimex (Wstat: 256 Tests: 2 Failed: 1) | |
Failed test: 2 | |
Non-zero exit status: 1 | |
Parse errors: Bad plan. You planned 8 tests but ran 2. | |
Files=1, Tests=2, 0 wallclock secs ( 0.01 usr 0.00 sys + 0.57 cusr 0.00 csys = 0.58 CPU) | |
Result: FAIL | |
make: *** [t/05-datetimex] Error 1 |
I'm really starting to love perl6. A lot of that is b/c of folk who just jump in and explain the way you have.
:)
Both list elts given to first are evaluated, so $file ends up always points to the rakudo source dir.
Oh! :)
say first * ~~ /a/, $f, $f [R~] 'b';
Note you could have just written:
say first /a/, $f, $f [R~]= 'b';
(Because Any method first
, which is called by sub first
, has a Regex variant.)
But yeah. I was thinking Rakudo wouldn't evaluate all the list elems because first
is lazy. But it does. So it's your turn. :) I'll return later to read what you've found out about this...
Interesting timing difference.
This stuff is all about list processing speed. And that will (hopefully) be profoundly altered by the recently begun GLR. Basically I recommend most folk don't worry about timing for this sort of stuff until August. If you want to focus on timing related to basic list operations because you find the news exciting, then pay close attention to GLR news.
Thanks again, this has been grand.
Yw. Please also feel free to post reddits and comments in /r/perl6. And of course, ask questions on #perl6. :)
So, ~3x faster on my box:
I'll be looking for your comments on #perl6 re: bugs in .lines()...but I might first try to find them on my own as an exercise.
Thanks again, this has been grand.