Instantly share code, notes, and snippets.

View perl6-coding-contest.md

In the good old times, I really enjoyed participating in Carl Mäsak's Perl 6 Coding Contest.

I'd like to revive this kind of contest, with a few small modifications.

Since running such a contest is a lot of work, I'd like to crowd-source parts of it. This is my idea of how it could work.

  • People can volunteer to be part of the group that crowd-sources the tasks. Of course, task creators cannot participate in the actual contest.
View stuff.txt
Armor Alamin Kinetic Vest
Armor Anti-Energy Coat
Armor Anti-Energy Flak Jacket
Armor Anti-Energy Jump Suit
Armor Anti-Energy Kaftan
Armor Anti-Energy Kataginu
Armor Anti-Energy Plate Armor
Armor Anti-Energy Saree
Armor Anti-Energy Suit
Armor Anti-Energy Trench
View taustation-nav.user.js
// ==UserScript==
// @name taustation_extended_nav
// @namespace https://github.com/moritz/
// @description Navigationi extension for taustation.space
// @match https://alpha.taustation.space/*
// @version 1
// @grant none
// @require http://code.jquery.com/jquery-latest.js
// ==/UserScript==
View actions.p6
grammar Enhanced-Paragraph {
token TOP { <superword>[ (\s+) <superword>]+ }
token superword { <word> | <enhanced-word> }
token word { \w+ }
token enhanced-word { \* <word> \* }
}
class Enhanced-Paragraph-actions {
method TOP ($/) { make [~] $/.caps».value.map({ .made // .Str }) }
method superword($/) { make $<enhanced-word>?? $<enhanced-word>.made !! $<word>.made }
View pdf-autosplit.p6
#!/usr/bin/env perl6
use v6;
sub page-numbers-from-chapters($filename) {
my $proc = run :out, 'pdftk', $filename, 'dump_data_utf8';
my %bookmark;
my @borders;
sub handle-bookmark() {
if %bookmark && (%bookmark<BookmarkLevel> // 0) == 1 {
View example-criteria.md

Criteria for Ideas

  • short enough to fit on a single page (usually; at most two)
  • doesn't require too much domain knowledge to appreciate
  • illustrates a Perl 6 feature or concept, preferably two
  • preferably something at least somewhat practical (no mammal hierarchy)
  • not too much setup work (no dependencies on a Zookeeper cluster or so)
View output.txt
moritz@pete:~/src/perl6book$ perl6 examples/uni.p6 dog
⺨ - U+02ea8 - CJK RADICAL DOG (2)
⽝ - U+02f5d - KANGXI RADICAL DOG (2)
🌭 - U+1f32d - HOT DOG (2)
🐕 - U+1f415 - DOG (2)
🐶 - U+1f436 - DOG FACE (2)
View t-spec-S12-attributes-mutators.t
our $count = 0;
class MagicVal {
has Int $.constant;
has Int $.varies = 0;
method varies is rw {
$count++;
return-rw Proxy.new(
# note that FETCH and STORE cannot go through the accessors
View slooow.p6
use v6;
sub timeit(Int $lines-after) {
my $preamble = qq[=begin code\n];
my $str = join "\n", $preamble, "Some more happy, happy lines of B<pod>\n\n including code\n\n" xx $lines-after;
my $before = now;
try EVAL qq[=begin pod\n\n$str\n\n\=end pod\n"];
my $after = now;
View strbuilder-bench.nqp
my @elems := nqp::list('abracadabra', '42', '', 'foobar', 'lskdfjasldfjk',
'abcd', 'zzzzz', 'flurbblerg', 'alsdjfslakdfjs', 'a', 'bb',
'abcd', 'zzzzz', 'flurbblerg', 'alsdjfslakdfjs', 'a', 'bb',
'abcd', 'zzzzz', 'flurbblerg', 'alsdjfslakdfjs', 'a', 'bb',
'abcd', 'zzzzz', 'flurbblerg', 'alsdjfslakdfjs', 'a', 'bb',
'abcd', 'zzzzz', 'flurbblerg', 'alsdjfslakdfjs', 'a', 'bb',
'abcd', 'zzzzz', 'flurbblerg', 'alsdjfslakdfjs', 'a', 'bb',
'abcd', 'zzzzz', 'flurbblerg', 'alsdjfslakdfjs', 'a', 'bb',
'abcd', 'zzzzz', 'flurbblerg', 'alsdjfslakdfjs', 'a', 'bb',
'abcd', 'zzzzz', 'flurbblerg', 'alsdjfslakdfjs', 'a', 'bb',