December 2011
3 posts
Referring to method parameters
In defmethod lambda lists, required parameters that aren’t explicitly specialized default to specializing on the system class t. But there’s a difference between an implicit and explicit specialization on t. The hyperspec explains: The expansion of the defmethod macro “refers to” each specialized parameter (see the description of ignore within the description of declare)....
Dec 30th
Describing objects
Everyone writes new methods for print-object for specialized printing of their own objects. But the output of describe can be specialized as well via describe-object. For example, if you have an object that has a vector of keys and a corresponding vector of values, the standard describe output might not show them in a way that’s very readable: * (describe record) #<RECORD...
Dec 15th
Forcing buffered output
Many CL implementations (SBCL in particular) perform output in a buffered manner. Sometimes this may cause a confusion, because it may reverse the order of effects. Like in the following example it may be possible to enter something before seeing ‘?’. (defun ask ()    (princ '?)    (read)) Also if you are writing an application, that should interact with some other program (for...
Dec 9th