문제

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!

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top