(wat-aro)

生きてます

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

OS X Yosemiteにswank-gaucheのインストール

きっかけはTwitter. @wat_aro どの処理系使ってるかわからないですがgaucheのswank-gaucheみたいに対応されてたりしませんか?— lispドラッグ常習者 (@rayfill) 2016, 1月 12 早速インストール. READMEに 設定方法 `dot.emacs'の内容を.emacsにコピーしてs…

SICP 問題 4.49

自然言語の構文解析用プログラムを少し改造するだけで文章の生成ができる. (define (an-element-of items) (require (not (null? items))) (amb (car items) (amb (cdr items)))) (define (parse-word word-list) (list (car word-list) (an-element-of (cd…

SICP 問題 4.48

adjectiveのみ追加する. ;; 冠詞の解析をparse-article-phraseにしてそこでmaybe-extendに進めばadjectiveも解析されるようにする. (define (parse-simple-noun-phrase) (list 'simple-noun-phrase (parse-article-phrase) (parse-word nouns))) (define (…

SICP 問題 4.47

(define (parse-verb-phrase) (amb (parse-word verbs) (list 'verb-phrase (parse-verb-phrase) (parse-prepositional-phrase)))) (parse '(the student with the cat sleeps in the class))これを例に考える. verbが問題なのでsleeps in the classだけに…

SICP 問題 4.46

構文解析器が右から左に非演算子を評価する時 perse-noun-phrase中の (amb noun-phrase (maybe-extend (list 'noun-phrase noun-phrase (parse-prepositional-phrase)))) で,maybe-extendが先に評価されてしまう. すると,実際に名詞が先にきた場合はmaybe…

SICP 問題 4.45

The professor lectures to the student in the class with the cat. これの5通りの構文解析結果を示す. まずはprofessor に in the class とwith the cat が掛かっている場合. 次はprofessorにwith the cat , student にin the classがかかっている場合…