File: stak.cl

package info (click to toggle)
gcl27 2.7.1-13
  • links: PTS
  • area: main
  • in suites: sid
  • size: 30,888 kB
  • sloc: lisp: 211,946; ansic: 52,944; sh: 9,347; makefile: 647; tcl: 53; awk: 52
file content (33 lines) | stat: -rw-r--r-- 726 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
;; $Header$
;; $Locker$

;;; STAK -- The TAKeuchi function with special variables instead of
;;; parameter passing.

(defvar stak-x)
(defvar stak-y)
(defvar stak-z)
(declaim (fixnum stak-x stak-y stak-z))

(defun stak (stak-x stak-y stak-z)
  (stak-aux))

(defun stak-aux ()
  (if (not (< stak-y stak-x))
      stak-z
    (let ((stak-x (let ((stak-x (the fixnum (1- stak-x)))
			(stak-y stak-y)
			(stak-z stak-z))
		    (stak-aux)))
	  (stak-y (let ((stak-x (the fixnum (1- stak-y)))
			(stak-y stak-z)
			(stak-z stak-x))
		    (stak-aux)))
	  (stak-z (let ((stak-x (the fixnum (1- stak-z)))
			(stak-y stak-x)
			(stak-z stak-y))
		    (stak-aux))))
      (stak-aux))))

(defun teststak ()
  (print (time (stak 18 12 6))))