From: John Atwood
Subject: How do I use pretty print?
Date: 
Message-ID: <6jefv4$dbv$1@news.NERO.NET>
I'm trying to learn how to use the pretty printing facilities of
Common Lisp.  I've found chapter 22 of Pitman's (Harlequin's) HyperSpec,
and chapter 27 of Steele's Cltl2, and Water's XP package, but how
do I use these tools to do useful things?  For starters, I'd like to 
be able to produce 2 or 3 formatting styles: one with closing parens
arranged "tail recursive":
    (defun foo (a b)
           (bar ... 
             (baz ...)))

the other with the closing parens "stacked", C style:
    (defun foo (a b)
           (bar ... 
             (baz ...
             )
           )
    )


Best I've done is:

(defun pp (file) ;ex: (pp "prog1")
 (with-open-file (s (load (concatenate 'string file ".lisp")))
  (with-open-file (s2 (merge-pathnames (concatenate 'string file
                  ".lispp"))
                  :direction :output :if-exists :supersede)
   (let ((*print-length* nil)
         (*print-depth*  nil))
     (do ((l (read s) (read s nil 'eof)))
         ((eq l 'eof) nil)
         (pprint l s2))))))
  

But this seems to ignore my print-depth. I'd also like it to
preserve the case of the symbols of the incoming code (that's
probably a readtable thingie).

I'm sure this has all been done, probably in Pitman/Steele/Water's docs,
but I can't find it.  Anyone? 



John Atwood
From: John Atwood
Subject: How to use Water's XP package, was: How do I use pretty print?
Date: 
Message-ID: <6k0bpt$6hn$1@news.NERO.NET>
John Atwood <·······@ice.CS.ORST.EDU> wrote:
>>>begin quoted text
I'm trying to learn how to use the pretty printing facilities of
Common Lisp.  I've found chapter 22 of Pitman's (Harlequin's) HyperSpec,
and chapter 27 of Steele's Cltl2, and Water's XP package, but how
do I use these tools to do useful things?  For starters, I'd like to 
be able to produce 2 or 3 formatting styles: one with closing parens
arranged "tail recursive":
    (defun foo (a b)
           (bar ... 
             (baz ...)))

the other with the closing parens "stacked", C style:
    (defun foo (a b)
           (bar ... 
             (baz ...
             )
           )
    )


Best I've done is:

(defun pp (file) ;ex: (pp "prog1")
 (with-open-file (s (load (concatenate 'string file ".lisp")))
  (with-open-file (s2 (merge-pathnames (concatenate 'string file
                  ".lispp"))
                  :direction :output :if-exists :supersede)
   (let ((*print-length* nil)
         (*print-depth*  nil))
     (do ((l (read s) (read s nil 'eof)))
         ((eq l 'eof) nil)
         (pprint l s2))))))


But this seems to ignore my print-depth. I'd also like it to
preserve the case of the symbols of the incoming code (that's
probably a readtable thingie).

I'm sure this has all been done, probably in Pitman/Steele/Water's docs,
but I can't find it.  Anyone? 



John Atwood
<<<< end quoted text

Let's see if a change of subject gets a non-null response.