在Scheme中是否有Common Lisp的*print-circle*的等价物?
我正在Scheme(SICP练习3.23)中研究双端队列,并且我有一个简单的双向链表实现,我想测试一下,但我似乎不知道如何在中打印出循环列表方案(mit-scheme 和 mzscheme/racket)。
在CL中有一个标志print-circle用于此类事情,Scheme中是否有等效的东西?我已经尝试过“with-output-to-truncated-string”,但这似乎在我从 Macports 获得的 mit-scheme 版本中不可用,尽管我认为它应该是?有什么方法可以在 REPL 上获取此过程吗?我需要包含一些内容吗?
http://sicp.ai.mit .edu/Fall-2003/manuals/scheme-7.5.5/doc/scheme_15.html
谢谢!
I'm working on a deque in Scheme (SICP exercise 3.23) and I've got a simple doubly-linked list implementation I would like to test out, but I can't seem to find out how to print out a circular list in Scheme (mit-scheme and mzscheme/racket).
In CL there is a flag print-circle for this sort of thing, is there anything equivalent in Scheme? I've tried "with-output-to-truncated-string" but that doesn't seem to be available in the build of mit-scheme I got from Macports although I think it should be? Is there some way of getting this procedure at the REPL, do I need to include something?
http://sicp.ai.mit.edu/Fall-2003/manuals/scheme-7.5.5/doc/scheme_15.html
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有任何标准可以做到这一点,但大多数方案实现都会有某种方法来控制其打印机。在 Racket 案例中,有
print-graph
参数执行此操作。但另请参阅 Racket 的 SICP 支持包,这将使您的 SICP 生活更加轻松。There is nothing standard to do this, but most Scheme implementations will have some way to control their printers. In the Racket case, there is the
print-graph
parameter that does it. But see also the SICP support package for Racket, which should make your life with SICP much easier.