[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Apologies
It has been pointed out to me that me translation of
RPG's latest program does not preserve its semantics
quite properly because "+" and "*" are typically proclaimed
SPECIAL in Common Lisp implementations and therefore are
dynamically bound whether you like it or not. Here is
a correct translation that avoids this problem, and I'll not
trouble you any further.
--Quux
(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 ([ ]))))