Skip to content

Commit

Permalink
Merge branch 'master' of git@github.com:rakudo/rakudo
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Apr 11, 2009
2 parents bb664df + e931dc0 commit 5b679a9
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 6 deletions.
5 changes: 3 additions & 2 deletions README
Expand Up @@ -108,8 +108,9 @@ C<parrot-dev@lists.parrot.org>.
The Rakudo and Parrot development teams tend to hang out on IRC a fair
bit, either on C<irc.freenode.net/#perl6> or C<irc.perl.org/#parrot>.

There is also a Rakudo related blog at L<http://rakudo.org/>, and
a Parrot blog at L<http://parrotblog.org/>. Most Perl 6 related news is
Rakudo's official web site is L<http://rakudo.org/>, where you can
find useful information for developers and users alike. There's also
a Parrot blog at L<http://parrotblog.org/>, most Perl 6 related news is
assembled at L<http://planetsix.perl.org/>.

=head2 Reporting bugs
Expand Down
1 change: 1 addition & 0 deletions docs/spectest-progress.csv
Expand Up @@ -323,3 +323,4 @@
"2009-04-08 00:00",a2728b4,8444,0,342,1960,10746,15589,349
"2009-04-09 00:00",4ae560c,10224,0,343,2050,12617,15627,354
"2009-04-10 00:00",70fc009,10284,0,344,2052,12680,15633,356
"2009-04-11 00:00",79aba97,10300,0,346,2074,12720,15676,359
44 changes: 40 additions & 4 deletions src/setting/Hash.pm
@@ -1,8 +1,44 @@
class Hash is also {
our Hash multi method reverse ( %hash: ) is export {
my %result;
(%result).{%hash.values} = %hash.keys;
%result;
multi method reverse () is export {
gather {
for @.pairs {
for @( .value ) -> $i {
take ($i => .key)
}
}
}
}

multi method push (*@values) {
my $previous;
my $has_previous;
for @values -> $e {
if $has_previous {
self!push_construct($previous, $e);
$has_previous = 0;
} elsif $e ~~ Pair {
self!push_construct($e.key, $e.value);
} else {
$previous = $e;
$has_previous = 1;
}
}
if $has_previous {
warn "Trailing item in Hash.push";
}
}

# push a value onto a hash item, constructing an array if necessary
method !push_construct (Object $key, Object $value) {
if self.exists($key) {
if self.{$key} ~~ Array {
self.{$key}.push: $value;
} else {
self.{$key} = [ self.{$key}, $value];
}
} else {
self.{$key} = $value;
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions t/spectest.data
Expand Up @@ -234,6 +234,7 @@ S06-traits/is-rw.t
S06-traits/misc.t
S09-subscript_slice/slice.t
S09-typed-arrays/arrays.t
S09-typed-arrays/hashes.t
S10-packages/use-with-class.t
S11-modules/export.t
S11-modules/import.t
Expand Down Expand Up @@ -320,6 +321,8 @@ S32-container/zip.t
S32-hash/exists.t
S32-hash/keys_values.t
S32-hash/pairs.t
S32-hash/push.t
S32-hash/reverse.t
S32-hash/slice.t
S32-list/end.t
S32-list/first.t
Expand Down

0 comments on commit 5b679a9

Please sign in to comment.