Matrix transposition: Difference between revisions

Line 277:
 
=={{header|Groovy}}==
The GroovyCollectionsGroovy extensions ti the List class provides a transpose method which will do the work for us:
<lang groovy>def matrix = [ [ 1, 2, 3, 4 ],
[ 5, 6, 7, 8 ] ]
Line 283:
matrix.each { println it }
println()
def transpose = GroovyCollectionsmatrix.transpose(matrix)
 
transpose.each { println it }</lang>
Anonymous user