[plt-scheme] Re: Formatting Code

From: Scott Owens (Scott.Owens at cl.cam.ac.uk)
Date: Wed Sep 19 08:48:58 EDT 2007

I'm not sure, but I suspect that multi-line indenting is accomplished  
with repeated calls to the single line indenter.

The single line indenter relies on the same information that the  
syntax coloring uses to know the lexical structure and parenthesis  
structure of the buffer.  The current implementation for finding a  
matching parenthesis is worst-case linear in the number of  
parentheses in the buffer.  My guess is that repeated calls to the  
single-line indenter cause it to repeatedly call for the same paren  
match and that a cache of paren matches might speed things up without  
having to implement and maintain a separate indenter for multiple  
lines (worst case would still be quadratic).  I've been meaning  
experiment with this for a few months now, when I get time.    
Currently, ETA in late October.


On Sep 16, 2007, at 11:32 AM, Majorinc, Kazimir wrote:

> Robby Findler wrote:
>> Try just assembling the sexp and then using pretty-print. I won't say
>> it is fast, but it is probably much faster.
>> Robby
> I'll find some way. But, this re-indent has solid advantages over  
> alternatives, except speed (even 5000 lines take minutes) - and  
> after that PLT. Probably current code for automatic indentation  
> uses some recursive procedure call with whole code that needs to be  
> indented passed as an argument (string or deep copied data  
> structure), O(n^2) time & space vs. O(n) for brute iteration over  
> string and only thing that need to be done is to eliminate that  
> call. Of course, I'm aware that PLT team has more important/ 
> interesting things to do.
> Thank you,
> Kazimir Majorinc
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Posted on the users mailing list.