tests/mzscheme/common/src/ackermann.mzscheme

;; END COMMENT
(define (main args)
  (let ((n (or (and (= (length args) 1) (string->number (car args))) 1)))
    (print-list "Ack(3," n "): " (ack 3 n))))

(define (ack m n)
  (cond ((zero? m) (+ n 1))
	((zero? n) (ack (- m 1) 1))
	(else      (ack (- m 1) (ack m (- n 1))))))

(define (print-list . items) (for-each display items) (newline))

Generated by GNU enscript 1.6.3.