このページで説明しているデバッグツールは、Debugging Aidsです。
私が試した短い実験から、私はあなたが複合手続きオブジェクトのソースを検査するpp
機能を使用することができると思う:
1 ]=> (define (sum-squares x y) (+ (* x x) (* y y)))
;Value: sum-squares
1 ]=> (sum-squares 3)
;The procedure #[compound-procedure 13 sum-squares]
;has been called with 1 argument
;it requires exactly 2 arguments.
;To continue, call RESTART with an option number:
; (RESTART 1) => Return to read-eval-print level 1.
2 error> (pp #[compound-procedure 13 sum-squares])
(named-lambda (sum-squares x y)
(+ (* x x) (* y y)))
;Unspecified return value
2 error>
あなたもlambda
機能のソースを得ることができると思われ、コンパイル関数:
1 ]=> (define (make-acc-gen n) (lambda (i) (set! n (+ n i)) n))
;Value: make-acc-gen
1 ]=> (pp (make-acc-gen 0))
(lambda (i)
(set! n (+ n i))
n)
;Unspecified return value
1 ]=> display
;Value 15: #[compiled-procedure 15 ("output" #x16) #x1a #x101b23bd2]
1 ]=> (pp #[compiled-procedure 15 ("output" #x16) #x1a #x101b23bd2])
(named-lambda (display object #!optional port environment)
(let ((port (optional-output-port port 'display)))
(unparse-object/top-level object port #f environment)
((%record-ref (%record-ref port 1) 14) port)))
;Unspecified return value
1 ]=>
リンク先のページには、他にも興味深い反射ツールがあります。 MIT Schemeには、特定のデバッグ作業に役立つファーストクラスのオブジェクトとして環境を混乱させるためのbunch of stuffもあります。希望が助けてくれる!
はい、これは多くの手助けをします。 – limist
さらに短く:(pp#@ 42)、42は手続き番号です。 – limist