Abstract
This paper proposes a new specification of pretty printing which is stronger than the state of the art: we require the output to be the shortest possible, and we also offer the ability to align sub-documents at will. We argue that our specification precludes a greedy implementation. Yet, we provide an implementation which behaves linearly in the size of the output. The derivation of the implementation demonstrates functional programming methodology.
- Pablo R. Azero and S. Doaitse Swierstra. 1998. Optimal Pretty Printing Combinators. (1998). Submitted to ICFP 1998.Google Scholar
- Richard Bird and Oege de Moor. 1997. Algebra of programming. Prentice-Hall, Inc. http://portal.acm.org/citation.cfm?id= 248932Google Scholar
- Kalyanmoy Deb, Karthik Sindhya, and Jussi Hakanen. 2016. Multi-objective optimization. In Decision Sciences: Theory and Practice. CRC Press, 145–184. Google Scholar
Cross Ref
- John Hughes. 1995. The Design of a Pretty-printing Library. In Advanced Functional Programming, First International Spring School on Advanced Functional Programming Techniques-Tutorial Text. Springer-Verlag, 53–96. http://portal.acm.org/ citation.cfm?id=734154 Google Scholar
Cross Ref
- Conor McBride and Ross Paterson. 2007. Applicative programming with effects. Journal of Functional Programming 18, 01 (2007), 1–13. DOI: Google Scholar
Digital Library
- Anton Podkopaev and Dmitri Boulytchev. 2014. Polynomial-Time Optimal Pretty-Printing Combinators with Choice. In Perspectives of System Informatics - 9th International Ershov Informatics Conference, PSI 2014, St. Petersburg, Russia, June 24-27, 2014. Revised Selected Papers. 257–265. DOI: Google Scholar
Cross Ref
- S. Doaitse Swierstra and Olaf Chitil. 2009. Linear, bounded, functional pretty-printing. Journal of Functional Programming 19, 01 (2009), 1–16. DOI: Google Scholar
Digital Library
- Philip Wadler. 1987. A critique of Abelson and Sussman or why calculating is better than scheming. ACM SIGPLAN Notices 22, 3 (1987), 83–94. Google Scholar
Digital Library
- Philip Wadler. 2003. A prettier printer. Palgrave MacMillan, 223–243. Google Scholar
Cross Ref
Index Terms
A pretty but not greedy printer (functional pearl)
Recommendations
Using the new common Lisp pretty printer
Although not part of the initial definition of the language, pretty printing has been an important feature of Lisp programming environments for twenty years or more [1]. By the time Common Lisp was being defined, the importance of pretty printing was ...
An Abstract Pretty Printer
The author has distilled the basic operations of the pretty printer into an abstract pretty printer that uses procedural parameters to perform low-level printing actions. By encapsulating the algorithm in one place, all the pretty-printing utilities ...
Greedy versus recursive greedy: Uncorrelated heuristics for the binary paint shop problem
AbstractIt is well-known that there are instances of the binary paint shop problem for which the recursive greedy heuristic is better than the greedy heuristic. In this note, we give an example of a family of instances where the greedy ...






Comments