Skip to content

Instantly share code, notes, and snippets.

@enigmaticape
Created November 5, 2012 09:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enigmaticape/4016193 to your computer and use it in GitHub Desktop.
Save enigmaticape/4016193 to your computer and use it in GitHub Desktop.
h(n) = 2^(h(n-1)) defined iteratively. SICP Exercise 1.10
;h(n) = 2^(h(n-1)) defined iteratively.
(define (h-iter-aux num prod count)
(if (= count 1)
prod
(h-iter-aux num (expt num prod) (- count 1))))
(define (h-iter n)
(if (= n 0)
0
(h-iter-aux 2 2 n)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment