原创 SICP Exercise 4.4

SICP Exercise 4.4 a)因爲數據導向的方式增加起來比較方便,所以我們繼續採用聯繫4.3中的方式: (define (eval-and exp env) (define (and-loop exps env) (

原创 SICP Exercise 4.2

SICP Exercise 4.2 a)由於eval中把過程應用放在最後面檢查,就可以簡單的認爲到達此處的任意複合表達式就是過程應用: (define (application? exp) (pair? exp)) 所以如果把過程應用放到

原创 SICP Exercise 4.1

SICP Exercise 4.1 1,用let表達式去控制求值的順序: (define (list-of-values-left-to-right exps env) (if (no-operands? exps) '(

原创 SICP Exercise 4.3

Exercise 4.3 在這個練習中,我需要一些對錶的操作,下面就是關於表的操作: (define (make-table) (let ((local-table (list '*table*))) (define (as

原创 Conditional Random Fields: A Beginner’s Survey

Conditional Random Fields: A Beginner’s Survey One interesting project that I am involved in these days involves c

原创 SICP Exercise 4.12

SICP Exercise 4.12 在這個練習中我們使用框架原有的表示,即把框架表示爲表的序對,而不是練習4.11中的方式。爲了把環境的遍歷和框架的遍歷分開,我增加了兩個過程,如下: (define (scan var frame)

原创 SICP 第4章求值器完整代碼

如果我們可以立即看到自己修改求值器後的運行結果,那將極大的激發我們的興趣,所以這裏給出第4章4.1節中元循環求值器的完整代碼,這樣在做練習提時,我們立馬就可以看到其效果。 在這裏,我們求值器分爲6個部分,它們分別是: evalapply

原创 名言

Paul Graham: nothing brings people closer than a common enemy.Nothing yields meaty problems like starting with the wro

原创 SICP Exercise 4.9

SICP Exercise 4.9 ;(for ; (define i 0) ; (< i 10) ; (set! i (+ i 1)) ; (display i)) ;(for <init> <condition> <ch

原创 SICP Exercise 4.6

SICP Exercise 4.6 ;(let ((var1 val1) (var2 val2) ...) body) (define (let->lambda exp) (let ((vars (let-vars exp))

原创 SICP Exercise 4.8

SICP Exercise 4.8 ;(define (fib n) ; (let fib-iter ((a 1) ; (b 0) ; (count n)) ; (i

原创 SICP Exercise 4.7

SICP Exercise 4.7 a)爲什麼let*表達式可以重寫爲一些嵌套的let表達式? 因爲嵌套的let表達式可以讓已經做了的約束都是可見的。例如: (let* ((x 3) (y (+ x 2))

原创 SICP Exercise 3.55

Exercise 3.55從上圖中可以看到,partial-sums的第i個元素等於其第(i-1)個元素加上stream的第i個元素。所以代碼如下:(define (partial-sums s) (cons-stream (stre

原创 linux core dump

core dump及應用 【1】core dump 概念 http://en.wikipedia.org.nyud.net:8080/wiki/Core_dump A core dump is the recorded state of

原创 SICP Exercise 4.5

SICP Exercise 4.5 (define (expand-clauses clauses) (if (null? clauses) 'false (let ((first (car clauses))