define-datatype.scm
以下の 2 行を追加してテストな手続きを動かしてみる事に。
(define eopl:error error) (define define-datatype:pretty-print print)
で、gosh 起動して以下。
$ gosh gosh> (add-load-path ".") ("." "/usr/share/gauche/site/lib" "/usr/share/gauche/0.8.13/lib") gosh> (load "define-datatype") define-datatype.scm version J3 2002-01-02 10:55 #t gosh> (define-datatype:test-all) ------------------------------ *** ERROR: unbound variable: sllgen:pretty-print Stack Trace: _______________________________________ 0 (sllgen:pretty-print example) At line 716 of "./define-datatype.scm" 1 (do-all-tests define-datatype:tester) At line 736 of "./define-datatype.scm" gosh>
動かぬ。sllgen:pretty-print がナニ。
使われてるのは define-datatype:tester の中。以下も追加でどうか。
(define sllgen:pretty-print print) (define eopl:error-stop error)
で、リトライ。
gosh> (load "define-datatype") define-datatype.scm version J3 2002-01-02 10:55 #t gosh> (define-datatype:test-all) ------------------------------ (sort-intlist '(8 6 7 5 3 0 9)) --> (0 3 5 6 7 8 9) ------------------------------ (lyst->list (list->lyst '(this is a weird form of identity))) --> (this is a weird form of identity) ------------------------------ (list (lyst-nil? (define-datatype:test:nil)) (lyst-nil? (define-datatype:test:pair 3 (define-datatype:test:nil)))) --> (#t #f) ------------------------------ (begin (define-datatype define-datatype:test:alist define-datatype:test:alist? (define-datatype:test:anil) (define-datatype:test:apair (head always?) (tail blist?))) (define-datatype define-datatype:test:blist define-datatype:test:blist? (define-datatype:test:bnil) (define-datatype:test:bpair (head always?) (tail define-datatype:test:alist?))) (define-datatype:test:apair 5 (define-datatype:test:bpair 4 (define-datatype:test:anil)))) --> *** ERROR: unbound variable: blist? Stack Trace: _______________________________________ 0 p 1 (for-each (lambda (a f p pname) (if (not (p a)) (define-datatype:r ... [unknown location] 2 (eval example (interaction-environment)) At line 731 of "./define-datatype.scm" 3 (write (eval example (interaction-environment))) At line 731 of "./define-datatype.scm" 4 (do-all-tests define-datatype:tester) At line 738 of "./define-datatype.scm" gosh>
これ、define-datatype:test3 か。自分で試験書いた方が良さげではありますが、2.2 を見つつ進めてみる方向で。