(wat-aro)

無職から有職者にランクアップしました

2016-01-18から1日間の記事一覧

SICP 問題 4.70

本文中のadd-assertion!とadd-rules!のletの目的は何か. 問題文のadd-assertion!ではダメな理由を述べよ. ;; 本文中のadd-assertion! (define (add-assertion! assertion) (store-assertion-in-index assertion) (let ((old-assertions THE-ASSERTIONS)) (…

SICP 問題 4.69

((great great grandson) adam Irad)のような質問ができるようにする. (rule (greatson-end ?x) (append-to-form ?u (grandson) ?x)) (rule ((grandson) ?x) (grandson ?x)) (rule ((great . ?rel) ?x ?y) (and (greatson-end ?rel) (son-of ?x ?z) (?rel ?z…

SICP 問題 4.68

(define (my-reverse lst) (let iter ((lst lst) (result '())) (if (null? lst) result (iter (cdr lst) (cons (car lst) result))))) (rule (append-to-form () ?y ?y)) (rule (append-to-form (?u . ?v) ?y (?u . ?z)) (append-to-form ?v ?y ?z)) (rever…