A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
11
Task/Matrix-transposition/Clojure/matrix-transposition-1.clj
Normal file
11
Task/Matrix-transposition/Clojure/matrix-transposition-1.clj
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
(defmulti matrix-transpose
|
||||
"Switch rows with columns."
|
||||
class)
|
||||
|
||||
(defmethod matrix-transpose clojure.lang.PersistentList
|
||||
[mtx]
|
||||
(apply map list mtx))
|
||||
|
||||
(defmethod matrix-transpose clojure.lang.PersistentVector
|
||||
[mtx]
|
||||
(vec (apply map vector mtx)))
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
=> (matrix-transpose [[1 2 3] [4 5 6]])
|
||||
[[1 4] [2 5] [3 6]]
|
||||
Loading…
Add table
Add a link
Reference in a new issue