Paste number 24115: ow ow ow

Paste number 24115: ow ow ow
Pasted by: Xof
When:2 years, 10 months ago
Share:Tweet this! | http://paste.lisp.org/+ILV
Channel:#lisp
Paste contents:
Raw Source | XML | Display As
(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.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.