| Paste number 24115: | ow ow ow |
| Pasted by: | Xof |
| 2 years, 4 months ago | |
| #lisp | |
| Paste contents: |
| (defclass listoid () ((caroid :initarg :caroid) (cdroid :initarg :cdroid :initform nil))) (defmethod lengthoid ((x listoid)) (let ((result 0)) (loop until (null x) do (incf result) (setq x (slot-value x 'cdroid))) result)) (assert (= (lengthoid (make-instance 'listoid)) 1)) (assert (= (lengthoid (make-instance 'listoid :cdroid (make-instance 'listoid :cdroid (make-instance 'listoid)))) 3)) |
This paste has no annotations.