----
for @array -> $element { # good
say $element;
}
for @array {
.say # good
}
.say for @array; # better
This file contains hidden or 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
use nqp; | |
my @a; | |
my Str $haystack = slurp 'tolstoy.txt'; | |
add-to-list("index with single codepoint needle", test-index($haystack, "\x[01]")); | |
my $target = 'abdicatez'; | |
add-to-list("index with word needle", test-index($haystack, $target)); | |
my $new-haystack; | |
for $haystack.comb(($haystack.chars / 20).Int) { | |
$new-haystack ~= $_; | |
} |
This file contains hidden or 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
my $*test-count = 0; | |
my @results; | |
my $b1 = { .defined }; | |
my $b2 = { 0 ≤ $_ }; | |
my @blocks = $b1, $b2; | |
test-it({ | |
my $b = 'a' x 999999 ~ 'b'; | |
$b ~~ /b/ for ^400; | |
}, | |
#$b1, |
This file contains hidden or 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 MAIN { | |
use Test; | |
my $char = 'a'; | |
my @result = what-matches($char); | |
for @result { | |
ok EVAL("'$char' ~~ /$_/"), "$char ~~ /$_/"; | |
} | |
} | |
use nqp; | |
sub what-matches (Str:D $chr) { |
This file contains hidden or 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
# Enter your code here. Read input from STDIN. Print output to STDOUT | |
use feature 'say'; | |
use v5.022; | |
use Data::Dumper; | |
my $lastAnswer = 0; | |
my $seqList = []; | |
#chomp(my $first_line = <STDIN>); | |
my $data = get_data("100 100 | |
1 345255357 205970905 | |
1 570256166 75865401 |
This file contains hidden or 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
# Enter your code here. Read input from STDIN. Print output to STDOUT | |
use feature 'say'; | |
use v5.022; | |
use Data::Dumper; | |
my $DEBUG = $ENV{da_DEBUG} // 1; | |
my $EVAL = $ENV{da_EVAL} // 0; | |
my $lastAnswer = 0; | |
my $seqList = []; | |
#chomp(my $first_line = <STDIN>); | |
my $data = get_data("100 100 |
This file contains hidden or 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
<?xml version="1.0"?> | |
<!--*- mode: xml -*--> | |
<interface> | |
<object class="GtkWindow" id="main_window"> | |
<property name="visible">True</property> | |
<property name="title" translatable="yes">Avahi Discovery</property> | |
<property name="type">GTK_WINDOW_TOPLEVEL</property> | |
<property name="window_position">GTK_WIN_POS_NONE</property> | |
<property name="modal">False</property> | |
<property name="default_width">500</property> |
This file contains hidden or 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
6 () { | |
local rl_text='' | |
if cmd-in-path rlwrap | |
then | |
rl_txt='rlwrap' | |
fi | |
if (( 0 < $# )) | |
then | |
local i | |
for i in $@ |
This file contains hidden or 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/lib/IRC/Client/Plugin/Github.pm6 b/lib/IRC/Client/Plugin/Github.pm6 | |
index c62bda1..62e1be3 100644 | |
--- a/lib/IRC/Client/Plugin/Github.pm6 | |
+++ b/lib/IRC/Client/Plugin/Github.pm6 | |
@@ -18,16 +18,15 @@ class IRC::Client::Plugin::Github does IRC::Client::Plugin | |
post "/" => sub { | |
my Str $event = request.headers<X_GITHUB_EVENT>.wordcase; | |
my Str $module = "IRC::Client::Plugin::Github::WebhookEvents::$event"; | |
- | |
- if (::{"&{$module}"} ~~ Nil) { |
This file contains hidden or 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/lib/IRC/Client/Plugin/Github.pm6 b/lib/IRC/Client/Plugin/Github.pm6 | |
index c62bda1..4eee807 100644 | |
--- a/lib/IRC/Client/Plugin/Github.pm6 | |
+++ b/lib/IRC/Client/Plugin/Github.pm6 | |
@@ -18,16 +18,15 @@ class IRC::Client::Plugin::Github does IRC::Client::Plugin | |
post "/" => sub { | |
my Str $event = request.headers<X_GITHUB_EVENT>.wordcase; | |
my Str $module = "IRC::Client::Plugin::Github::WebhookEvents::$event"; | |
- | |
- if (::{"&{$module}"} ~~ Nil) { |