Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save danking/1410839 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*)
-> ((hyperize + 0) 2 4)
8
-> ((hyperize + 0) 2 3)
6
-> ((hyperize + 0) 2 10)
20
-> ((hyperize (hyperize + 0) 1) 2 3)
8
-> ((hyperize (hyperize + 0) 1) 2 4)
16
;; http://en.wikipedia.org/wiki/Tetration#Definition
-> ((hyperize (hyperize (hyperize + 0) 1) 1) 2 3) ; 2^(2^2) = 2^4
16
-> ((hyperize (hyperize (hyperize + 0) 1) 1) 2 4) ; 2^(2^(2^2)) = 2^(2^4) = 2^16
65536
;; http://en.wikipedia.org/wiki/Pentation
-> ((hyperize (hyperize (hyperize (hyperize + 0) 1) 1) 1) 2 3)
65536
-> ((hyperize (hyperize (hyperize (hyperize + 0) 1) 1) 1) 2 4)
;; Still Running...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment