Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
;; This file:
;;   http://anggtwu.net/LISP/2025-defstruct.lisp.html
;;   http://anggtwu.net/LISP/2025-defstruct.lisp
;;          (find-angg "LISP/2025-defstruct.lisp")
;; Author: Eduardo Ochs <eduardoochs@gmail.com>
;;
;; (defun e () (interactive) (find-angg "LISP/2025-defstruct.lisp"))



* (eepitch-sbcl)
* (eepitch-kill)
* (eepitch-sbcl)

* (eepitch-sly)
* (eepitch-kill)
* (eepitch-sly)

(defstruct myab a b)
(defvar ab1)
(setq   ab1 (make-myab  :a 20  :b 30))

ab1 ;; -> #S(MYAB :A 20 :B 30)

(defmethod print-object ((p myab) stream)
  (with-slots (a b) p
    (format stream "~a_~a" a b)))

ab1 ;; -> 20_30

(defvar m)
(setq   m (find-method
	   #'print-object '()
	   (mapcar #'find-class '(myab t))))

(remove-method #'print-object m)

ab1 ;; -> #S(MYAB :A 20 :B 30)









































* (eepitch-sbcl)
* (eepitch-kill)
* (eepitch-sbcl)

(defstruct  myab a b)
(defstruct (myabc (:include myab)) c)
(defvar ab1)
(defvar abc1)
(setq ab1  (make-myab  :a 20  :b 30))
(setq abc1 (make-myabc :a 200 :b 300 :c 400))

ab1
;; -> #S(MYAB :A 20 :B 30)

(defmethod print-object ((p myab) stream)
  (with-slots (a b) p
    (format stream "~a_~a" a b)))

ab1
;; -> 20_30

;; What is the syntax here?
(remove-method print-object myab)
(remove-method 'print-object 'myab)
(remove-method #'print-object 'myab)
(remove-method #'print-object myab)

(find-method







































abc1

(cl-defmethod cl-print-object ((ab myab) stream)
  (princ (format "%s__%s" (myab-a ab) (myab-b ab)) stream))

(cl-defmethod cl-print-object ((abc myabc) stream)
  (princ (format "%s_%s_%s" (myabc-a abc) (myabc-b abc) (myabc-c abc)) stream))

(cl-defmethod cl-print-object ((ab myab) stream)
  (cl-call-next-method))

(cl-defmethod cl-print-object ((abc myabc) stream)
  (cl-call-next-method))





;; (find-2a nil '(find-clprin2 ab1))
;; (find-2a nil '(find-clprin2 abc1))

;; (find-angg "LISP/tostring1.lisp")



;; Local Variables:
;; coding:  utf-8-unix
;; End: