Browse files

Simplify tranpose a bit more.

  • Loading branch information...
1 parent 90690bd commit 4878de0a0b1102687bd76a5a96e8db8a3721e0fa @nunorc nunorc committed Sep 10, 2010
Showing with 4 additions and 4 deletions.
  1. +1 −1 CREDITS
  2. +3 −3 lib/List/Utils.pm
View
2 CREDITS
@@ -1,3 +1,3 @@
Solomon Foster (colomon)
-smashz / smash
+Nuno Carvalho (smashz/smash)
Moritz Lenz
View
6 lib/List/Utils.pm
@@ -48,15 +48,15 @@ sub take-while(@a, Mu $test) is export(:DEFAULT) {
sub transpose(@list is copy) is export(:DEFAULT) {
gather {
- while @list !~~ [] {
+ while @list {
my @heads;
- if @list[0] ~~ Numeric {
+ if @list[0] !~~ Positional {
@heads = @list.shift;
}
else {
@heads = @list.map({$_.shift unless $_ ~~ []});
}
- @list = map {$_ unless $_ ~~ []}, @list;
+ @list = @list.map({$_ unless $_ ~~ []});
take [@heads];
}
}

0 comments on commit 4878de0

Please sign in to comment.