>>1
(DEFUN FU (&REST XS) (CONCATENATE 'STRING "FU" XS))
Defines a function FU in the current package. FU takes a variable number of arguments, those arguments are consed up in a list XS, and that list is used as an argument to
[/m]CONCATENATE
[/m]. Valid arguments could be characters like:
(FU #\U #\U \#!);=> "FUUU!"
(SETQ FU "U")
This is actually an undefined operation at the toplevel, but in general, it will set the FU's symbol's (global) value, so equivalent to
(set 'fu "U") or
(setf (symbol-value 'fu) "U"). The tricky part here is that in general you'd want to use
DEFVAR or
DEFPARAMETER which does the same thing, but also proclaims the symbol special (of course, it's also bad style to not use earmuff's when naming globally special symbols, so it should be
*fu*). Most implementations will just set the
SYMBOL-VALUE, however some (CMUCL?) will also proclaim the symbol special, which can have negative consequences like not being able to declare variables named after this symbol lexically(since it's proclaim special).
tl;dr: Don't do global
SETQ's unless you know what your implementation does, instead use forms which describe your intent EXACTLY (such as a set of
SYMBOL-VALUE or a
DEFVAR/
DEFPARAMETER, which show the intent and no implementation will behave differently here). It should also be noted that some saner implementations like SBCL will warn you if you do a global setq, saying that the variable is undefined (and just perform a set on
SYMBOL-VALUE, no special proclamation).
* (FU FU FU FU FU)
Calls function FU with 4 arguments(each being the value of the symbol FU, which is "U" in this case). If symbol FU had the value #\! (or some other character), this call would make sense, and the result would be "FU!!!!", however in your case, FU is a string, and doing CONCATENATE of a character and a string does not work, it's a
type-error. Most implementations would signal
type-error here. Strangely yours doesn't and it treats those string pointers as unicode characters or something? I have no idea if such behaviour is standards compliant or not, but I'm too lazy to open up Hyperspec and look this up.