$array->keys->map(sub { [ $_, $array->[$_] ] });
}
+sub each {
+ my ($array, $sub) = @_;
+ for my $i (0 .. $#$array) {
+ $sub->($i, $array->[ $i ]);
+ }
+}
+
+sub each_key {
+ my ($array, $sub) = @_;
+ for my $i (0 .. $#$array) {
+ $sub->($i);
+ }
+}
+
+sub each_value {
+ my ($array, $sub) = @_;
+ $sub->($_) for @$array;
+}
+
+# end indexed
+
sub flatten {
@{$_[0]}
}
sub slice {
my ($hash, $keys) = @_;
return [ @{$hash}{@$keys} ];
-};
+}
+
+sub each {
+ my ($hash, $sub) = @_;
+ for my $key (CORE::keys %$hash) {
+ $sub->($key, $hash->{$key});
+ }
+}
+
+sub each_key {
+ my ($hash, $sub) = @_;
+ $sub->($_) for CORE::keys %$hash;
+}
+
+sub each_value {
+ my ($hash, $sub) = @_;
+ $sub->($_) for CORE::values %$hash;
+}
+
+
+# End Indexed
sub print { CORE::print %{$_[0]} }
sub say { CORE::print %{$_[0]}, "\n" }