Is there an equivalent of Common Lisp's *print-circle* in Scheme?
I'm working on a deque in Scheme (SI开发者_Go百科CP 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!
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.
精彩评论