Skip to content

Instantly share code, notes, and snippets.

@salortiz
Last active February 26, 2021 22:09
Show Gist options
  • Save salortiz/73a92a15857759cf2eccec9c0df24db6 to your computer and use it in GitHub Desktop.
Save salortiz/73a92a15857759cf2eccec9c0df24db6 to your computer and use it in GitHub Desktop.
Give them some rope
role Str2Pos does Positional does Iterable {
has $!b handles <elems EXIST-POS> = self.encode;
method AT-POS(\i) { $!b[i].chr }
method iterator { (.chr for $!b.list).iterator }
}
my @s := "Give them some rope" but Str2Pos;
dd @s[3,8,11];
dd @s.list;
for @s { .say };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment