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
| #!~/tools/rakudo/perl6 | |
| my $search_word = @*ARGS.shift; | |
| my $replacement = @*ARGS.shift; | |
| sub UpperCaseEachWord($word) | |
| { | |
| my @words = $word.split('_'); | |
| my @uppered = map {$_.lc.ucfirst}, @words; | |
| return @uppered.join(''); | |
| } |
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 v6; | |
| my $in = open "01.pl", :r or die "Unable to open 01.pl: $!\n"; | |
| my $out = open "02.pl", :w or die "Unable to open 02.pl: $!\n"; | |
| for $in.lines | |
| { | |
| when /\#/ { $out.say: $_; } | |
| when /(.*)\"(.*)\"(.*)/ | |
| { |
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 v6; | |
| my $in = open "01.pl", :r or die "Unable to open 01.pl: $!\n"; | |
| my $out = open "02.pl", :w or die "Unable to open 02.pl: $!\n"; | |
| for $in.lines | |
| { | |
| when /\#/ { $out.say: $_; } | |
| when /(.*)\"(.*)\"(.*)/ | |
| { |
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 v6; | |
| my %dictionary; | |
| slurp("big.txt").comb(/<alpha>+/).map({%dictionary{$_.lc}++}); | |
| my @alphabet = 'a'..'z'; | |
| sub edits($word) { | |
| my @s = (^$word.chars).map({$word.substr(0, $_), $word.substr($_)}); | |
| my @deletes = @s.map(-> $a, $b { $a ~ $b.substr(1); }); |
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 STD; | |
| use Syntax::Highlight::Perl6; | |
| my @input = <>; | |
| my $input = join "", @input; | |
| # Creates the Perl6 syntax highlighter object | |
| my $p = Syntax::Highlight::Perl6->new( | |
| text => $input | |
| ); |
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
| rat.t needs: | |
| Num.Rat -- think this is blocked on list assignment | |
| Rat.new -- with no arguments used to work, now doesn't | |
| eval -- this is simply not implemented in ng yet | |
| sin -- Just don't think we have trig yet | |
| exp -- not sure if this one works or not yet | |
| <a b c>.[4/3] -- not sure why this doesn't work, parsing maybe? |
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
| # .get example | |
| class MapIterator does Iterator { | |
| has $.base-iterator; | |
| has $.code; | |
| multi method get() { | |
| my $value = $.base-iterator.get; | |
| $value ~~ Good ?? $.code($value) !! $value; | |
| } |
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
| > say 1, 2 X~ 'a', 'b'; | |
| Null PMC access in clone() | |
| > Wynne:rakudo colomon$ | |
| Wynne:rakudo colomon$ ./perl6 --target=pir | |
| > say 1, 2 X~ 'a', 'b'; | |
| .HLL "perl6" | |
| .namespace [] | |
| .sub "_block11" :anon :subid("10_1268960012.49592") |
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/src/Perl6/Grammar.pm b/src/Perl6/Grammar.pm | |
| index 00c3f07..234677f 100644 | |
| --- a/src/Perl6/Grammar.pm | |
| +++ b/src/Perl6/Grammar.pm | |
| @@ -938,7 +938,7 @@ token numish { | |
| [ | |
| | <dec_number> | |
| | <integer> | |
| -# | <rad_number> | |
| + | <rad_number> |
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
| multi sub is(Iterable $got, Iterable $expected, $desc) is export { | |
| my @got; | |
| my @expected; | |
| my $test = True; | |
| loop { | |
| my $a = $got.get; | |
| my $b = $expected.get; | |
| if ($a ~~ EMPTY) || ($b ~~ EMPTY) { | |
| unless ($a ~~ EMPTY) && ($b ~~ EMPTY) { | |
| $test = False; |
OlderNewer