From: Tanaka Akira Date: 2002-01-14T20:09:31+09:00 Subject: Re: MetaRuby : RubySchema.rb howto? In article , Robert Feldt writes: > Ok, then there are some simplifications because the standard funcprog > pretty-printing libraries are known to have non-linear complexities. Since Wadler's pretty printing is very simple, I think it is possible. (I think it is simplest.) > Olaf Chitil: > Pretty Printing with Lazy Dequeues > Preliminary Proceedings of the 2001 ACM SIGPLAN Haskell Workshop, Firenze, > Italy, Universiteit Utrecht UU-CS-2001-23, 2 September 2001, pp. 183-201. > > which is an implementation of Oppen's pretty printing algorithm in > Haskell. Oppens alg is based on dynamic programming and is fast. I don't > think it is as expressive as Azero's approach though. Interesting. > you could then get > > [1, 2, 3, 4, > 5, 6, 7] > > which I think is a bit nicer. > > Would it be possible? Impossible, I think. > BTW, do you support indented groups like the one for the elements above > that indent the position of the first element of the second line (5) to > the same as the first element of the group on the first line (1)? With prettyprint.rb which is implementation of Wadler's pretty printing without extentions, I think only two format is possible: [1, 2, 3, 4, 5, 6, 7] or [1, 2, 3, 4, 5, 6, 7] Because breakable positions contained by a (non-nested) group cannot mix spaces and breaks. I think we needs more powerful library. Although I don't know which algorithm is better: extention to Wadler's or other algorithms. -- Tanaka Akira