I feel as though I'm in the same ballpark as Basic Lisp Macro error but when I imagine how the code should look when expanded I don't see a problem and macroexpand isn't helping because it just doesn't want to output anything I can print; macroexpand just runs the code for me.
(setf my-array (make-array 4 :initial-element 3))
(print my-array)
(setf (aref my-array 2) 5)
(print my-array)
(defmacro set3To5 (arrnum)
(print (arrayp arrnum))
(print arrnum)
(setf (aref arrnum 3) 5)
)
(set3To5 my-array)
Running this gives me the output
argument MY-ARRAY is not an array
but if 'arrnum' is replaced by 'my-array' then it should be fine?
To quote from the linked question
Now on macro expansion, the macro ADD-TEST is called with the parameter VAR getting the value G, a symbol.
Certainly my-array is a symbol and it is the symbol I wish to manipulate so why is there a problem?
Long story short, the code should look like this to leave you with an array of (3 3 5 5).
GNU Common Lisp, at least, cares a lot about the difference between ` and ' (those are backtick/backquote and quote/apostrophe characters). What does backtick mean in LISP? The comma operator undoes the quotation for an element in the list, allowing you to plug in parameters or local variables, do ",@" for splicing in a list.
Lisp macros execute the code within their bodies and the return result should be a form that can then be executed, that is macro expansion.
It seems to be they just decided on magic to define how the two backquoted lines are both turned into code because it seems like you would have to put them both within a list and backquote the entire list and then return that list, but it does look neater this way.