[gambit-list] bug with write?

naruto canada narutocanada at gmail.com
Sun Sep 14 00:23:07 EDT 2008


On 9/14/08, Christian Jaeger <christian at pflanze.mine.nu> wrote:
> 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))))
>
>

Thanks, this is all I need for transformations.



More information about the Gambit-list mailing list