Skip to content

Instantly share code, notes, and snippets.

@danking
Created November 30, 2011 21:25
Show Gist options
  • Select an option

  • Save danking/1410935 to your computer and use it in GitHub Desktop.

Select an option

Save danking/1410935 to your computer and use it in GitHub Desktop.
(define (hyperize f id-e)
(define (f* b n)
(if (zero? n) id-e (f b (f* b (sub1 n)))))
f*)
;; modified Knuth Up-Arrow notation
(define (↑ n)
(cond ((zero? n) +)
((= n 1) (hyperize + 0))
(else (hyperize (↑ (sub1 n)) 1))))
-> ((↑ 0) 4 5)
9
-> ((↑ 0) 4 10)
14
-> ((↑ 0) 2 3)
5
-> ((↑ 1) 2 3)
6
-> ((↑ 2) 2 3)
8
-> ((↑ 3) 2 3)
16
-> ((↑ 4) 2 3)
65536
-> ((↑ 5) 2 3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment