1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2; File: tak.sch 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; 22-Jul-87 (Will Clinger) 8; Language: Scheme 9; Status: Public Domain 10;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 11 12;;; TAK -- A vanilla version of the TAKeuchi function 13 14(define (tak x y z) 15 (if (not (< y x)) 16 z 17 (tak (tak (- x 1) y z) 18 (tak (- y 1) z x) 19 (tak (- z 1) x y)))) 20 21;;; call: (tak 18 12 6) 22 23(let ((input (with-input-from-file "input.txt" read))) 24 (time 25 (let loop ((n 500) (v 0)) 26 (if (zero? n) 27 v 28 (loop (- n 1) (tak 18 12 (if input 6 0))))))) 29