RosettaCodeData/Task/Identity-matrix/Common-Lisp/identity-matrix-2.lisp

6 lines
176 B
Common Lisp
Raw Permalink Normal View History

2019-09-12 10:33:56 -07:00
(defun identity-matrix (n)
(loop for a from 1 to n
collect (loop for e from 1 to n
if (= a e) collect 1
else collect 0)))