(wat-aro)

生きてます

2016-02-06から1日間の記事一覧

SICP 問題 5.34

反復的階乗手続きをコンパイルし,再帰版との本質的な違いを示せ. 反復的階乗手続きの内容を説明する. (compile '(define (factorial n) (define (iter product counter) (if (> counter n) product (iter (* counter product) (+ counter 1)))) (iter 1 1…

SICP 問題 5.33

以下の2つの翻訳結果を比較してその相違を説明する. (compile '(define (factorial n) (if (= n 1) 1 (* (factorial (- n 1)) n))) 'val 'next) (compile '(define (factorial n) (if (= n 1) 1 (* n (factorial (- n 1))))) 'val 'next) 一つ目を出力して…