;;; .EnTete "Le-Lisp (c) version 15.2" " " "The Le-Lisp Benchmarks (4)"
;;; .EnPied "ctak.ll" "%" " "
;;; .SuperTitre "The Le-Lisp Benchmarks (4)"
;;;
;;; .Centre "*****************************************************************"
;;; .Centre " Ce fichier est en lecture seule hors du projet ALE de l'INRIA. "
;;; .Centre " Il est maintenu par ILOG SA, 2 Avenue Gallie'ni, 94250 Gentilly "
;;; .Centre " (c) Le-Lisp est une marque de'pose'e de l'INRIA "
;;; .Centre "*****************************************************************"
;;;
;;; .Centre "$Header: ctak.ll,v 1.1 88/10/29 22:10:56 chaillou Exp $"
;;; (4) CTAK -- Version of TAK that uses CATCH and THROW.
(defun check-ctak ()
(check-value '(test-ctak 1) 7))
(defun meter-ctak ()
(perform-meter '(ctak 18 12 6) 'ctak))
(defun test-ctak (n)
(if (eq n 1)
(ctak 18 12 6)
(repeat n (ctak 18 12 6))))
(defun ctak (x y z)
(tag ctak-aux (ctak-aux x y z)))
(de ctak-aux (x y z)
(if (not (lt y x))
(exit ctak-aux z)
(ctak-aux (tag ctak-aux (ctak-aux (sub1 x) y z))
(tag ctak-aux (ctak-aux (sub1 y) z x))
(tag ctak-aux (ctak-aux (sub1 z) x y)))))