RosettaCodeData/Task/Identity-matrix/Clojure/identity-matrix-4.clj
2023-07-01 13:44:08 -04:00

4 lines
125 B
Clojure

(defn identity-matrix [n]
(take n
(partition n (dec n)
(cycle (conj (repeat (dec n) 0) 1)))))