You try to use (n n)
, but that is Lisp syntax for calling a function named n
with an argument n
. You should invoke make-array
like this:
(make-array (list n n) :initial-element 0)
Вопрос
Well, the flawed function is as follows:
(defun make-matrix (n)
(make-array (n n) :initial-element 0))
I want to use functions like (make-matrix 8)
to replace the longer (make-array '(8 8) :initial-element 0)
, but CLISP says there is a fault in (n n)
, because n
is not a defined function. How do I write this make-matrix
function?
Решение
You try to use (n n)
, but that is Lisp syntax for calling a function named n
with an argument n
. You should invoke make-array
like this:
(make-array (list n n) :initial-element 0)