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; | |
class Path { | |
has Str $!path; | |
method new (Str $str) { | |
my Str $path; |
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; | |
class Growl { | |
has Str $.app_name; | |
method new (Str $app_name = "Perl6 Growl Library") { | |
self.bless(*, app_name => $app_name); | |
} |
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; | |
sub mD6 { | |
gather { take 6.rand.Int + 1 for 0..* } | |
} | |
sub nD10 { | |
gather { take 10.rand.Int for 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; | |
multi sub infix:<D> ($lhs, $rhs) { | |
my $sum = 0; | |
$sum += $rhs.rand.Int for 1..$lhs; | |
return $sum; | |
} | |
multi sub infix:<D> ($lhs, $rhs where {$_ == 6} ) { | |
return &infix:<D>.candidates[0]($lhs, $rhs) + $lhs; |
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; | |
class Bitmap { | |
has IO $!file; | |
has %!header; | |
has $!w_count; | |
has $!h_count; | |
has $!remainder; | |
has $!template; |
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 strict; | |
use warnings; | |
use Imager; | |
mkdir "numbers"; | |
mkdir "modified"; | |
mkdir "concat"; | |
for (@ARGV) { | |
chop for 1..4; |
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; | |
class T { | |
has $.with_accessor; | |
has $!without_accessor; | |
method new ($i as Int) { | |
self.bless(*, with_accessor => $i, without_accessor => $i); | |
} |
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; | |
class CA { | |
has @.data; | |
has @.rule; | |
method new ($rule, $length, $population) { | |
my @data = (1 xx $population, 0 xx $length - $population).pick(*); | |
my @rule = $rule.fmt("%08b").flip.comb.map({.Int}); | |
self.bless(*, data => @data, rule => @rule); |
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
# This version is very old! | |
# Latest code is here ↓ | |
# https://github.com/VienosNotes/Domino/blob/master/domino.pl | |
use v6; | |
grammar Lisp { | |
token left { '(' }; | |
token right { ')' }; | |
token num { \d+ } |
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; | |
sub mapBetween ($op, *@list) { | |
(@list Z @list[1..*]).map({ $op($^a,$^b) }); | |
} | |
my @list = 1,2,3,4,5; | |
say mapBetween(&infix:<+>, @list); | |
say mapBetween(&infix:<+>, 1,2,3,4,5); | |
# 3 5 7 9 |
OlderNewer