Skip to content

Instantly share code, notes, and snippets.

View zoffixznet's full-sized avatar
💭
😂

Zoffix Znet zoffixznet

💭
😂
View GitHub Profile
zoffix@leliana:/tmp/tmp.YvNSdWF7by$ perl6 -e '"a b c" ~~ m:g/(\w+)/; say $/'
(「a」
0 => 「a」 「b」
0 => 「b」 「c」
0 => 「c」)
zoffix@leliana:/tmp/tmp.YvNSdWF7by$ perl6 -e '"a b c" ~~ m:g/(\w+)/; $/».gist.join("\n-------\n").say'
「a」
0 => 「a」
-------
「b」
zoffix@leliana:~/CPANPRC/rakudo/t/spec$ tg socket
│   ├── ./S32-io/IO-Socket-Async.t
│   ├── ./S32-io/IO-Socket-Async-UDP.t
│   ├── ./S32-io/IO-Socket-INET.bat
│   ├── ./S32-io/IO-Socket-INET.pl
│   ├── ./S32-io/IO-Socket-INET.sh
│   ├── ./S32-io/IO-Socket-INET.t
│   ├── ./S32-io/socket-accept-and-working-threads.t
│   ├── ./S32-io/socket-fail-invalid-values.t
│   ├── ./S32-io/socket-host-port-split.rakudo.moar
say ‚hi‘; # meow
Calling parse
Calling TOP
Calling statementlist
Calling statement
Calling statement:sym<fuc>
Calling fucbody
Calling ident
Calling ws
Calling ww
Calling ws
use NQPHLL;
grammar Perl7::Grammar is HLL::Grammar {
token TOP {
:my $*CUR_BLOCK := QAST::Block.new(QAST::Stmts.new());
<statementlist>
[ $ || <.panic('Perl 7 syntax error')> ]
}
token ws { <!ww> \h* || \h+ }
cpan@perlbuild2~/CPANPRC/rakudo (nom)$ make t/spec/S02-types/num.t
rm -f -- perl6
cp -- perl6-m perl6
chmod -- 755 perl6
/home/cpan/perl5/perlbrew/perls/perl-5.24.0/bin/perl t/harness5 --fudge --moar --keep-exit-code --verbosity=1 t/spec/S02-types/num.t
ok 1 - EVAL 1.Num.perl is Num
ok 2 - EVAL 1.Num.perl is 1
ok 3 - EVAL 0.Num.perl is Num
ok 4 - EVAL 0.Num.perl is 0
$ perl6 -e 'my $Foo = EVALFILE "Foo.pm6"; $Foo.foo; sleep 10; $Foo = EVALFILE "Foo.pm6"; $Foo.foo'
hi
bye
$ cat Foo.pm6
my class Foo {
method foo { say "bye" }
}
my $sum = 0;
for (1..2015) -> $term {
$sum += $term;
my $sqr = sqrt $sum;
my $fsqr = floor sqrt $sum ;
my $factors;
$sum %% $_ and $factors +=2 for 1..$fsqr;
$factors-- if $fsqr == $sqr;
}
say now - INIT now;
my $sum = 0;
for (1..2015) -> $term {
$sum += $term;
my $factors = 2 * do for (1..floor(sqrt($sum))) -> $x {
$sum % $x == 0 ?? $x !! Empty
}
$factors-- if floor(sqrt($sum)) == sqrt($sum);
}
say now - INIT now;
my $sum = 0;
for (1..2015) -> $term {
$sum += $term;
my $factors = (1..floor(sqrt($sum))).elems * 2;
$factors-- if floor(sqrt($sum)) == sqrt($sum);
}
say now - INIT now;