Skip to content

Instantly share code, notes, and snippets.

@shirok
Created January 22, 2011 21:19
Show Gist options
  • Save shirok/791492 to your computer and use it in GitHub Desktop.
Save shirok/791492 to your computer and use it in GitHub Desktop.
(define (ack m n)
(cond ((zero? m) (+ n 1))
((zero? n) (ack (- m 1) 1))
(else (ack (- m 1) (ack m (- n 1))))))
#|
gosh> (time (ack 3 10))
;(time (ack 3 10))
; real 6.488
; user 6.480
; sys 0.010
8189
gosh> (time (ack 1 2))
;(time (ack 1 2))
; real 0.000
; user 0.000
; sys 0.000
4
gosh> (time (ack 4 1))
;(time (ack 4 1))
; real 419.934
; user 419.470
; sys 0.430
65533
|#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment