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
doug@ender:~/study$ perl6 -e 'say "Hôtel"' | |
Hô¿½xF4tel | |
doug@ender:~/study$ perl6 -e 'say "Hôtel".chars' | |
5 | |
doug@ender:~/study$ perl6 -e 'say "Hôtel"' | od -Ax -t x1 | |
000000 48 f4 8f bf bd 78 46 34 74 65 6c 0a | |
00000c | |
doug@ender:~/study$ perl6 -e 'utf8.new(0xF4, 0x8f, 0xbf, 0xbd).Str.ord.&{ "%x".sprintf($_) }.say' | |
10fffd | |
doug@ender:~/study$ perl6 -e 'utf8.new(0xF4, 0x8f, 0xbf, 0xbd).Str.uniname.say' |
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; | |
grammar Chord { | |
rule TOP { <key> \S* } | |
regex bare-key { <key> <!before \S > } | |
regex bare-key-one { <key> [ <!before \S > | $ ] } | |
regex bare-key-two { <key> <!before <:!Space> > } | |
token natural-note { <[ A..G ]> } | |
token accidental { <[ \# b ]> } | |
regex key { <natural-note> <accidental>? } |
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
doug$ cat z2.pl6 | |
use v6; | |
my $s = "Zoé"; | |
.chr.print for |$s.NFC, 10; | |
.chr.print for |$s.NFD, 10; | |
doug$ perl6 z2.pl6 | |
Zoé | |
Zoé | |
perl6 z2.pl6 | perl6 -e '$*IN.encoding(<utf8>); my $z1 = $*IN.get; my $z2 = $*IN.get; say $z1 eq $z2' | |
True |
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
unit package TestD; | |
role R { | |
method foo( --> Int ) { ... } | |
} | |
class C { | |
has R $.delegate | |
handles * | |
is required; |
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
#!/usr/bin/env perl6 | |
use v6; | |
use MONKEY-SEE-NO-EVAL; | |
# "project_gbclient_t_controller_signup_process_purchase_validation_07-wordpress_blog_title_t" | |
my @raw-names = $*IN.lines.grep({ / ^ '"' <[ \w - ]>+ '"' $ / })».EVAL; | |
.say for @raw-names; | |
# cat 185_valid_test_names.txt | MVM_SPESH_DISABLE= bin/unquote_via_eval.p6 | wc -l | |
# 108 [ non-repeatable count ] | |
# cat 185_valid_test_names.txt | MVM_SPESH_DISABLE=1 bin/unquote_via_eval.p6 | wc -l |
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; | |
constant size := 8; | |
my @corners = map { $_[0] * size + $_[1] }, ((0, size-1) X (0, size-1)); | |
our class Square is Int { | |
has Int $!piece; | |
method new (|) { | |
Metamodel::Primitives.rebless( |