[gambit-list] bug with write?

Christian Jaeger christian at pflanze.mine.nu
Sat Sep 13 15:54:47 EDT 2008


You would be able to get it down to:

> '(foo syntax 1)
(foo . #'1)

Dunno about the reason.

If you wanted, you could try this simple, unfinished and unpolished printer instead:

(define (pretty-print x)
  (cond ((symbol? x)
	 (display x)
	 (display " "))
	((string? x)
	 (display (list #\" x #\" #\space)))
	((pair? x)
	 (display #\()
	 (let lp ((x x))
	   (pretty-print (car x))
	   (let ((d (cdr x)))
	     (cond ((null? d)
		    (display #\)))
		   ((pair? d)
		    (lp d))
		   (else
		    (display #\.)
		    (pretty-print d))))))
	((null? x)
	 (display #\()
	 (display #\)))
	((number? x)
	 (display x)
	 (display #\space))
	(else
	 (error "don't know type of:" x))))




More information about the Gambit-list mailing list