Last active
November 16, 2017 05:07
-
-
Save tolitius/590dc57f4d7154e83699109278880317 to your computer and use it in GitHub Desktop.
transpose N x N matrices
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=> (defn transpose [m] | |
(apply mapv vector m)) | |
=> (transpose [[1 2] [3 4]]) | |
[[1 3] [2 4]] | |
=> (transpose [[1 2 3] [4 5 6] [7 8 9]]) | |
[[1 4 7] [2 5 8] [3 6 9]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment