(wat-aro)

生きてます

2015-12-06から1日間の記事一覧

SICP 問題 3.49

ある口座の内容によって次にアクセスする口座の内容がかわるような状況. 具体的な状況は思い浮かばず.

SICP 問題 3.48

;; make-accountの引数にidを追加. ;; dispatchの引数に'numberで口座番号を参照できる. (define (make-account-and-serializer balance id) (define (withdraw amount) (if (>= balance amount) (begin (set! balance (- balance amount)) balance) "Insu…

SICP 問題 3.47

#| このような形でmake-semaphoreは使われる. |# (define (make-serializer) (let ((semaphore (make-semaphore 6))) (lambda (p) (define (serialized-p . args) (semaphore 'acquire) (let ((val (apply p args))) (semaphore 'release) val)) serialized…