This question already has an answer here:
I'm trying to create a function that receives a number of lines and columns and makes an array out of it. This is what I did
(defun create-table (lines columns)
(make-array '(lines columns)))
I thought this is how you make a multidimensional array. But as I call the function create-table
for example (create-table 2 2)
this error is given
MAKE-ARRAY: dimension LINES is not of type `(INTEGER 0 (,ARRAY-DIMENSION-LIMIT))
I don't understand, how could it not be an integer? Should I make a cast?
What do you think '(lines columns)
evaluates to?
Hint: you can create lists with the function LIST
.
There is an error in your function
Try like this
(defun create-table (lines columns)
(make-array `(,lines ,columns)))
来源:https://stackoverflow.com/questions/19726593/how-to-make-an-array-with-size-received-as-arguments-in-a-function-in-lisp