home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume1 / 8707 / 49 / tak.cl < prev    next >
Lisp/Scheme  |  1990-07-13  |  685b  |  25 lines

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ; File:         tak.cl
  3. ; Description:  TAK benchmark from the Gabriel tests
  4. ; Author:       Richard Gabriel
  5. ; Created:      12-Apr-85
  6. ; Modified:     12-Apr-85 09:58:18 (Bob Shaw)
  7. ; Language:     Common Lisp
  8. ; Package:      User
  9. ; Status:       Public Domain
  10. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  11.  
  12. ;;; TAK -- A vanilla version of the TAKeuchi function
  13.  
  14. (defun tak (x y z)
  15.   (declare (fixnum x y z))
  16.   (if (not (< y x))
  17.       z
  18.       (tak (tak (1- x) y z)
  19.        (tak (1- y) z x)
  20.        (tak (1- z) x y))))
  21.  
  22. ;;; call: (tak 18 12 6)
  23.  
  24. (run-benchmark "TAK" '(tak 18 12 6))
  25.