SICP 연습문제 1.10 풀이

분류없음 | 2008/12/20 13:49 | The Doctor
이 문서는 Structure and Interpretation of Computer, by Abelson, Sussman, and Sussman의 라이센스 이용허가규약 저작자표시-비영리에 따라 제작된 문서입니다.

혼자 공부하면서 풀어본 것입니다. 그런만큼 오류가 많을 것이라 생각합니다. 문제 있는 부분은 알려주시면 고맙겠습니다.

Exercise 1.10.  The following procedure computes a mathematical function called Ackermann's function.

(define (A x y)
  (cond ((= y 0) 0)
        ((= x 0) (* 2 y))
        ((= y 1) 2)
        (else (A (- x 1)
                 (A x (- y 1))))))

What are the values of the following expressions?


(A 1 10)


펼쳐두기..


(A 2 4)

펼쳐두기..


(A 3 3)

펼쳐두기..



Consider the following procedures, where A is the procedure defined above:

(define (f n) (A 0 n))

(define (g n) (A 1 n))

(define (h n) (A 2 n))

(define (k n) (* 5 n n))

Give concise mathematical definitions for the functions computed by the procedures fg, and h for positive integer values of n. For example, (k n) computes 5n2.




펼쳐두기..





참고사항

Ackermann function : wikipedia 애커만 함수 항목
이전 1 ... 3 4 5 6 7 8 9 10 11 ... 16 다음