Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add Any.kv to provide .kv for Positionals and scalars, as well as a p…
…roto sub for kv.
  • Loading branch information
colomon committed Feb 25, 2010
1 parent 9f11da6 commit 64305d7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/core/Any-list.pm
Expand Up @@ -162,6 +162,15 @@ augment class Any {
}
}
}

multi method kv() {
my $i = 0;
gather for $.list -> $value {
my $key = $i++;
take $key;
take $value;
}
}
}

our proto sub join (Str $separator = '', *@values) { @values.join($separator); }
Expand All @@ -175,5 +184,6 @@ our proto sub max($by, *@values) { @values.max($by); }
our proto sub uniq(@values) { @values.uniq; }
our proto sub pick ($num, :$replace, *@values) { @values.pick($num, :$replace); }
our proto sub map(&mapper, @values) { @values.map(&mapper); }
our proto sub kv(@array) { @array.kv; }

# vim: ft=perl6

0 comments on commit 64305d7

Please sign in to comment.