View gist:11404980
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub term:<1sec>() { Duration.new(1) } | |
sub term:<1second>() { Duration.new(1) } | |
sub term:<1min>() { Duration.new(60) } | |
sub term:<1minute>() { Duration.new(60) } | |
sub term:<1hour>() { Duration.new( 60 * 60 ) } | |
sub term:<1day>() { Duration.new( 24 * 60 * 60 ) } | |
sub term:<1week>() { Duration.new( 7 * 24 * 60 * 60 ) } | |
sub postfix:<secs>($secs) { Duration.new($secs) } | |
sub postfix:<seconds>($seconds) { Duration.new($seconds) } |
View Proxy huh????
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A is Hash { | |
method at_key(A:D $hash: $k) { | |
Proxy.new( | |
FETCH => { | |
say "in FETCH with $k"; | |
$hash.exists_key($k) ?? $hash{$k} !! Int; | |
}, | |
STORE => -> $old, $new { | |
if $new > 0 { | |
$hash{$k} = $new; |
View gist:80b8c5b3a02f8a742c0c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/core/BagHash.pm b/src/core/BagHash.pm | |
index 21a35b8..960ea99 100644 | |
--- a/src/core/BagHash.pm | |
+++ b/src/core/BagHash.pm | |
@@ -1,39 +1,31 @@ | |
-my class BagHash does Baggy { | |
+my class BagValue is Int { | |
+ has $!hash; | |
+ has $!key; | |
+ |
View gist:48b2c6e3a246eb9f0e25
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for ^Inf -> $job { | |
last if state $x; | |
state $tap = signal(SIGINT).tap( { | |
say "\b\bwaiting for job #$job to be done"; | |
$x = True; | |
} ); | |
LAST { $tap.close } | |
my $working = 5.rand; | |
say "job #$job for {$working.fmt('%.2f')} seconds"; |
View gist:2bbcb4f8799f689da1ff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ perl6-j t/spec/S04-phasers/in-loop.rakudo.jvm | |
1..3 | |
Exception in thread "main" org.perl6.nqp.runtime.UnwindException | |
at org.perl6.nqp.runtime.ThreadContext.<init>(ThreadContext.java:119) | |
at org.perl6.nqp.runtime.GlobalContext.getCurrentThreadContext(GlobalContext.java:324) | |
at org.perl6.nqp.runtime.GlobalContext.<init>(GlobalContext.java:239) | |
at org.perl6.nqp.runtime.CompilationUnit.enterFromMain(CompilationUnit.java:56) | |
at perl6.main(gen/jvm/main.nqp) |
View gist:c12ccd3b9812f49188b1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# t/spec/foo.t | |
use Test; | |
plan 1; | |
#?rakudo todo 'huh?' | |
throws_like( { die }, X::Comp); | |
============================= |
View gist:72dc142c2aac6b402b64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
t/spec/S02-literals/radix.rakudo.parrot (Wstat: 0 Tests: 7 Failed: 0) | |
Parse errors: Bad plan. You planned 135 tests but ran 7. | |
t/spec/S02-magicals/DISTRO.rakudo.parrot (Wstat: 0 Tests: 24 Failed: 0) | |
Parse errors: Bad plan. You planned 28 tests but ran 24. | |
t/spec/S02-magicals/KERNEL.rakudo.parrot (Wstat: 256 Tests: 32 Failed: 1) | |
Failed test: 29 | |
Non-zero exit status: 1 | |
t/spec/S02-magicals/VM.rakudo.parrot (Wstat: 0 Tests: 29 Failed: 0) | |
Parse errors: Bad plan. You planned 32 tests but ran 29. | |
t/spec/S02-names/is_cached.t (Wstat: 512 Tests: 38 Failed: 2) |
View gist:65d9e44743dffca1157c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ./Foo.pm | |
my sub EXPORT(*@a) { | |
say "in EXPORT"; | |
( '$*FOO' => ++state $ ).hash; | |
} | |
============== works as expected | |
$ perl6 -I. -e 'use Foo; say $*FOO; { use Foo; say $*FOO }; say $*FOO' | |
in EXPORT |
View gist:4f31120e7ca6bbebc16d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/docs/ops.markdown b/docs/ops.markdown | |
index 30554c7..a71c968 100755 | |
--- a/docs/ops.markdown | |
+++ b/docs/ops.markdown | |
@@ -1685,6 +1685,7 @@ constants below can be used in nqp as (e.g.) `nqp::const::CCLASS_ANY`. | |
* CCLASS_ALPHANUMERIC | |
* CCLASS_NEWLINE | |
* CCLASS_WORD | |
+ * CCLASS_CRLF | |
View gist:ab00347d5cc44a23c65b
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub ROLLPICKGRABN( # N times | |
$self, $count, @pairs is rw, :$keep | |
) is hidden_from_backtrace { | |
my Int $total = $self.total; | |
my Int $rand; | |
my Int $seen; | |
my int $todo = ($keep ?? $count !! ($total min $count)) + 1; | |
gather { | |
while $todo = $todo - 1 { |
OlderNewer