[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
A Couple of Fun Programs
Date: 31 Mar 87 1531 PST
From: Dick Gabriel <RPG@sail.stanford.edu>
Now that you've seen the instructional version of the second
puzzle function, here's the slightly bummed (15% faster) version:
...
And, as a further public service, here is a translation:
(defun f (*)
(labels ((> (*)
(cond ((zerop *) (values 1 0))
((= * 1) (values 1 1))
((evenp *)
(multiple-value-bind (+ /)
(> (/ * 2))
(values (+ (* + +) (* / /))
(+ (* + /) (* / (- + /))))))
(t
(multiple-value-bind (+ /)
(> (- * 1))
(values (+ + /) +))))))
(values (> *))))
--Quux