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 @type = (1..3).list; | |
| my @rare = (0..5).list; | |
| my @num = (1..29).list; | |
| my @plus = (1..3).list; | |
| my $cmd; | |
| for @type X @rare X @num X @plus -> $t, $r, $n, $p { | |
| $cmd = 'wget http://example.com/directory/' ~ $t ~ $r ~ $n.fmt("%03d") ~ $p.fmt("%02d") ~ ".jpg"; |
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
| #include<stdio.h> | |
| #include<math.h> | |
| int main (int argc, char** argv) { | |
| char* count = argv[1]; | |
| int d = 0; | |
| int ans = 0; | |
| while (*(count++) != '\0'); | |
| count -= 2; | |
| do { |
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; | |
| 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 |
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
| # 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 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; | |
| 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 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; | |
| class T { | |
| has $.with_accessor; | |
| has $!without_accessor; | |
| method new ($i as Int) { | |
| self.bless(*, with_accessor => $i, without_accessor => $i); | |
| } |
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 strict; | |
| use warnings; | |
| use Imager; | |
| mkdir "numbers"; | |
| mkdir "modified"; | |
| mkdir "concat"; | |
| for (@ARGV) { | |
| chop for 1..4; |
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; | |
| class Bitmap { | |
| has IO $!file; | |
| has %!header; | |
| has $!w_count; | |
| has $!h_count; | |
| has $!remainder; | |
| has $!template; |
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; | |
| 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 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; | |
| sub mD6 { | |
| gather { take 6.rand.Int + 1 for 0..* } | |
| } | |
| sub nD10 { | |
| gather { take 10.rand.Int for 0..* } | |
| } |