[comp.lang.lisp] indent for scheme, lisp

dak@sq.sq.com (David A Keldsen) (06/08/90)

dak@sq.sq.com (David A Keldsen) writes:

>Before I take the plunge, and re-invent the wheel, does anyone happen to
>have a publically available lisp indenter available?  

The responses I've gotten so far (amazingly fast, thanks folks!) show
that I need to put more constraints on this request.  In particular,
this indenter has to be:

	1) Stand-alone,
	2) Small,
	3) Portable (assume C or Scheme is available, *nothing else*)
	4) Free (including of constraints, hence no GNU code).
		(Don't worry, if it's PD, and I improve it, 
		 the improvements will be PD)

Has anyone here ever thought of writing a variant of (read) [call it
(read-with-comments)] that retains comments?  It would make writing a
"keeps comments" pretty printer much easier...

Again, please reply by mail; I'll summarize and post.

Thanks!
-- 
// David A. 'Dak' Keldsen:  dak@sq.com or utai[.toronto.edu]!sq!dak
// "I have heard the mermaids singing, each to each."  -- T.S.Eliot

Chewy@cup.portal.com (Paul Frederick Snively) (06/09/90)

RE: reasonable Lisp indentation algorithms...

I believe there are a couple of MIT AI Lab notes available that address this
issue.  I seem to recall reading somewhere about a code formatter that even
does its job in linear time, which sounds pretty amazing to me.

In any case, off the top of my head, it seems to me that you should be able to

1) copy your Lisp's standard readtable and hack it so as not to ignore
   comments, and
2) somehow integrate the results with XP, Dick Waters' highly-extensible
   pretty-printing package, which is available via FTP to wheaties.ai.mit.edu.

Hope this helps!