Details
-
New Feature
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.1-beta-2
-
None
-
None
Description
Groovy should have a transpose method like:
Ruby's transpose() method on arrays
Python's zip() method
expected behaviour:
assert [['a', 'b'], [1, 2, 3]].transpose() == [['a', 1], ['b', 2]]
assert transpose(['a', 'b'], [1, 2, 3]) == [['a', 1], ['b', 2]]
assert transpose([1, 2, 3], [4, 5, 6]) == [[1, 4], [2, 5], [3, 6]]
assert transpose([1, 2, 3], [4, 5], [9], [6, 7, 8]) == [[1, 4, 9, 6]]
assert transpose([1, 2, 3]) == [[1], [2], [3]]
assert transpose([]) == []