当我在Dr. Racket或命令行中运行测试时,失败的测试总是在一行上。
例如,
(bad (interp-t-prog (list '(class posn extends object ((x : num) (y : num)) (mdist : num -> num (+ (get this x) (get this y))) (addDist : posn -> num (+ (send arg mdist 0) (send this mdist 0)))) '(class posn3D extends posn ((z : num)) (mdist : num -> num (+ (get this z) (super mdist arg))))) `this) -1 "no type" "at line 96")
除了手动输入空格外,有没有办法让消息格式化得更好?
答案 0 :(得分:2)
您的代码或Racket库是否产生错误?
pretty-print
会帮助你吗?
#lang racket
(pretty-print
'(bad (interp-t-prog (list '(class posn extends object ((x : num) (y : num)) (mdist : num -> num (+ (get this x) (get this y))) (addDist : posn -> num (+ (send arg mdist 0) (send this mdist 0)))) '(class posn3D extends posn ((z : num)) (mdist : num -> num (+ (get this z) (super mdist arg))))) `this) -1 "no type" "at line 96"))
=>
'(bad
(interp-t-prog
(list
'(class posn
extends
object
((x : num) (y : num))
(mdist : num -> num (+ (get this x) (get this y)))
(addDist : posn -> num (+ (send arg mdist 0) (send this mdist 0))))
'(class posn3D
extends
posn
((z : num))
(mdist : num -> num (+ (get this z) (super mdist arg)))))
`this)
-1
"no type"
"at line 96")