home *** CD-ROM | disk | FTP | other *** search
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; File: stak.cl
- ; Description: STAK benchmark
- ; Author: Richard Gabriel
- ; Created: 12-Apr-85
- ; Modified: 12-Apr-85 09:54:50 (Bob Shaw)
- ; Language: Common Lisp
- ; Package: User
- ; Status: Public Domain
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ;;; STAK -- The TAKeuchi function with special variables instead of parameter passing.
-
- (defvar *x*)
- (defvar *y*)
- (defvar *z*)
-
- (proclaim '(type fixnum *x* *y* *z*))
-
- (defun stak (*x* *y* *z*)
- (stak-aux))
-
- (defun stak-aux ()
- (if (not (< *y* *x*))
- *z*
- (let ((*x* (let ((*x* (1- *x*))
- (*y* *y*)
- (*z* *z*))
- (stak-aux)))
- (*y* (let ((*x* (1- *y*))
- (*y* *z*)
- (*z* *x*))
- (stak-aux)))
- (*z* (let ((*x* (1- *z*))
- (*y* *x*)
- (*z* *y*))
- (stak-aux))))
- (stak-aux))))
-
- ;;; call: (stak 18 12 6))
-
- (run-benchmark "STAK" '(stak 18 12 6))
-