Common Lisp is a wonderfully complex language, and probably no matter how long you've been studying it, you'll always find a thing you didn't know before.

What, for example, do you think #0AFFFF represents?

Perhaps you're thinking of the color turquoise represented as a hexadecimal RGB value?

Well, witness for yourself:
CL-USER> (setf *read-base* 16)

(Bonus point if you know how to restore *READ-BASE* to a value of 10 again.)

Still no idea?
CL-USER> (type-of *)
Right, #0AFOO is literal syntax for (make-array nil :initial-element 'foo).

And, yeah, even though Common Lisp is surely a complex beast, it's at the same time very well engineered. Witness thus:
CL-USER> (defvar *a*
           (make-array nil :initial-element 41))
CL-USER> (incf (aref *a*))
CL-USER> *a*
And if you want to see really quirky stuff, take a look at strings with an element-type of nil.

No comments: