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
module Printf | |
%default total | |
-- Formatting AST. | |
data Format | |
= FInt Format | |
| FString Format | |
| FOther Char Format | |
| FEnd |
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
use MONKEY-TYPING; | |
augment class Any { | |
method foo { | |
say "hello world"; | |
} | |
} | |
"blah".foo; |
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
my $compile-time-sub; | |
sub call-compile-time-sub() is export { note 'before'; $compile-time-sub(); note 'after'; } | |
BEGIN { $compile-time-sub = -> { <.so .dll .dylib>.map("lib/" ~ *); }; } | |
call-compile-time-sub() |
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
use v6; | |
=begin pod | |
=TITLE Simple Infix Arithmetic Calculator | |
=AUTHOR Yichun Zhang | |
Operators supported: +, -, *, /, and ^. |
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 postfix:<!> (Int $n) { | |
fail "Not a Natural Number in Factorial" if $n < 0; | |
[*] 2..$n | |
} | |
use Test; | |
isa-ok (-1)!, Failure, "Factorial for -1 fails"; | |
ok 0! == 1, "Factorial for 0"; | |
ok 1! == 1, "Factorial for 1"; | |
ok 5! == 120, "Factorial for a larger integer"; |
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 TreeNode { | |
has Int $!item; | |
has TreeNode $!left; | |
has TreeNode $!right; | |
method spawn(Int \item, Int \depth) { | |
return ChildTreeNodes(item, depth - 1); | |
} | |
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
C:\Users\mwilson\src\rakudo>"C:\Users\mwilson\src\rakudo\install\bin\moar" --execname="perl6-m" --libpath="C:\Users\mwilson\src\rakudo\install\share\nqp\lib" --libpath="." C:\Users\mwilson\src\rakudo\perl6-debug.moarvm --ll-exception t\04-nativecall\01-argless.t | |
>>> LOADING t\04-nativecall\01-argless.t | |
>>> LOADING C:\Users\mwilson\src\rakudo\t\04-nativecall\CompileTestLib.pm | |
+ C:\Users\mwilson\src\rakudo\t\04-nativecall\CompileTestLib.pm (1 - 3) | |
| unit module CompileTestLib; | |
| | |
| my @cleanup; # files to be cleaned up afterwards | |
> | |
Too many positionals passed; expected 1 argument but got 2 | |
at gen/moar/m-Metamodel.nqp:2779 (./blib/Perl6/Metamodel.moarvm:new:0) |
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
use v6; | |
my $chan = '#perl6'; | |
await IO::Socket::Async.connect('irc.freenode.net',6667).then( -> $p { | |
my $sock = $p.result; | |
$sock.print("NICK P6\nUSER P6 Perl6 work :Perl6 Perl6\nJOIN $chan\n"); | |
my $timer = Promise.in(3).then({ now }); | |
react { | |
whenever $timer -> $now { | |
say "Now is $now\n"; | |
$sock.print: ":P6!P6\@work PRIVMSG $chan : diakopter Now is $now\n"; |
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
Test Summary Report | |
------------------- | |
t/04-nativecall/02-simple-args.t (Wstat: 256 Tests: 12 Failed: 1) | |
Failed test: 11 | |
Non-zero exit status: 1 | |
t/04-nativecall/03-simple-returns.t (Wstat: 256 Tests: 11 Failed: 1) | |
Failed test: 3 | |
Non-zero exit status: 1 | |
t/04-nativecall/13-union.t (Wstat: 768 Tests: 28 Failed: 3) | |
Failed tests: 2, 15, 24 |
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
>>> Bash: bash test/test.bash | |
Igpay atinlay | |
Ingystray ingythay | |
Iway Ikelay Applesway | |
PASS | |
>>> C++: g++ -o test/test-cpp test/test.cpp && test/test-cpp | |
Igpay atinlay | |
Ingystray ingythay | |
Iway Ikelay Applesway |
NewerOlder