Created
June 22, 2010 13:51
-
-
Save masak/448480 to your computer and use it in GitHub Desktop.
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
$ ./perl6 t/spec/S32-str/encode.t | |
1..13 | |
ok 1 - $str.encode returns a Buf | |
ok 2 - encoding to ASCII | |
ok 3 - right length of Buf | |
ok 4 - encoding to UTF-8 | |
ok 5 - right length of Buf | |
get_pmc_keyed() not implemented in class '' | |
in 'at_pos' at line 1056:CORE.setting | |
in 'postcircumfix:<[ ]>' at line 1053:CORE.setting | |
in main program body at line 1 | |
$ git diff | |
diff --git a/src/core/Buf.pm b/src/core/Buf.pm | |
index 5d7d7d8..457e5ee 100644 | |
--- a/src/core/Buf.pm | |
+++ b/src/core/Buf.pm | |
@@ -1,4 +1,4 @@ | |
-role Buf[::T = Int] does Stringy { | |
+role Buf[::T = Int] does Stringy does Positional { | |
has T @.contents; | |
multi method new(@contents) { | |
@@ -34,6 +34,10 @@ role Buf[::T = Int] does Stringy { | |
multi method elems() { | |
@.contents.elems; | |
} | |
+ | |
+ multi method postcircumfix:<[ ]>(*@indices) { | |
+ @.contents[|@indices]; | |
+ } | |
} | |
our multi sub infix:<eqv>(Buf $a, Buf $b) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment