Unit Test: programlisting.005

A programlisting within a table

Michael Smith

Table 1. Lisp function
(defun cycle-length (n & (len 1) (top 0))
  (cond ((= n 1) (values len top))
        ((evenp n) (cycle-length (ash n -1) (1+ len) (max top n)))
        (t (let ((next (1+ (* 3 n))))
             (cycle-length next (1+ len) (max top next))))))