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
pmichaud@plum:~$ cat x.pl | |
#!/usr/bin/perl | |
my @a = 1..10; | |
foreach (grep { $_ % 2 } @a) { $_++; } | |
print "@a\n"; | |
pmichaud@plum:~$ perl x.pl |
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
pmichaud@kiwi:~/p6/rakudo$ ./perl6 | |
> my $h = Hash[Str,Int].new; | |
().hash | |
> $h{3} = 'hello'; # okay | |
hello | |
> $h{'hello'} = 'hello'; # fails key check | |
Nominal type check failed for parameter 'key'; expected Int but got Str instead | |
> $h{4} = 15; # fails value check | |
Type check failed in assignment to '$v'; expected 'Str' but got 'Int' |
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 foo { | |
state @ENDS; | |
my $foo = 'foo'; | |
mkdir $foo; | |
@ENDS.push: { rmdir $foo }; | |
END { .() for @ENDS } | |
} |
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
pmichaud@kiwi:~/p6/rakudo$ cat rcx.p6 | |
sub table ($base,$power) { | |
my $digits = ($base ** $power).chars; | |
printf "%{$digits}s lsb msb\n", 'number'; | |
for ^$power { | |
my $x = $base ** $_; | |
printf "%{$digits}d %2d %2d\n", $x, $x.lsb, $x.msb; | |
} | |
} | |
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 msb(Int $self) { | |
return Nil if $self == 0; | |
return 0 if $self == -1; | |
my $msb = 0; | |
my $x = $self; | |
$x = ($x + 1) * -2 if $x < 0; # handle negative conversions | |
while $x > 0xff { $msb += 8; $x +>= 8; } | |
if $x > 0x0f { $msb += 4; $x +>= 4; } | |
if $x +& 0x8 { $msb += 3; } | |
elsif $x +& 0x4 { $msb += 2; } |
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
pmichaud@kiwi:/zip/perl/rakudo-star-2013.01$ cat bbkr.p6 | |
use HTTP::Easy::PSGI; | |
my $app = sub (%env) { | |
print %env.perl; | |
return [ 204, [ ], [ ] ]; | |
}; | |
my $psgi = HTTP::Easy::PSGI.new( host => "", port => 8080); | |
$psgi.app( $app ); | |
$psgi.run; |
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
pmichaud@kiwi:/zip/perl/rakudo-star-2012.12$ cat bbkr.p6 | |
use HTTP::Easy::PSGI; | |
my $app = sub (%env) { | |
print %env.perl; | |
return [ 204, [ ], [ ] ]; | |
}; | |
my $psgi = HTTP::Easy::PSGI.new( host => "", port => 8080); | |
$psgi.app( $app ); | |
$psgi.run; |
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
pmichaud@kiwi:~/p6/rakudo$ ls | |
blib CREDITS dynext LHF.markdown LICENSE parrot src tools | |
Configure.pl docs INSTALL.txt lib nqp README t VERSION | |
pmichaud@kiwi:~/p6/rakudo$ git clean -xdf | |
Removing nqp/ | |
Removing parrot/ | |
Removing t/spec/ | |
pmichaud@kiwi:~/p6/rakudo$ ls nqp | |
3rdparty LICENSE nqp_group.h QASTNode.pbc | |
config.status Makefile nqp_group.o QAST.pbc |
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
c255f1d interpolation of e.g. regexes in arrays in regexes | |
483ce86 [docs] update the download step in the release guide | |
42f8ead Some formatting updates to 2013.02 announcement. | |
f67e101 Update the release guide | |
78d2a2a [release] Add a new release announcement | |
c89dd87 [release] bump VERSION | |
256339c [release] bump NQP revision |
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
pmichaud@kiwi:~/p6/nqp$ git log --graph --oneline f8a37df..f03f15a | |
* f03f15a bump VERSIOn to 2013.02.1 | |
* 21a6b2c Fix braino in nqp_dyncall.ops. | |
* 1cc0d94 Wrap a Parrot detail up in a QAST::VM. | |
* 883fd06 bump VERSION to 2013.02 | |
* 688763c Toss outdated comment. | |
* 866304d Toss long-broken --dumper option and related code. | |
* 6f3692d Port EXPR to NQP. Much code from kboga++. | |
* 2ddd4dc Merge pull request #75 from perl6/ops-fixes | |
|\ |
NewerOlder