ansi-common-lisp

Redefinition of the print-object method for conses has different effects in different CL implementations

吃可爱长大的小学妹 提交于 2021-01-27 19:59:46
问题 Trying to print conses not in standard list notation, but always as dotted pairs, with the minimum effort, I have redefined the method print-object in this way: (defmethod print-object((c cons) str) (format str "(~a . ~a)" (car c) (cdr c))) but the effect is different for different implementations. In Clozure CL and in LispWorks Personal the result is what I was expecting: CL-USER 1 > (defmethod print-object((c cons) str) (format str "(~a . ~a)" (car c) (cdr c))) #<STANDARD-METHOD PRINT