On Sun, Jun 1, 2008 at 5:21 PM, Marc Feeley feeley@iro.umontreal.ca wrote:
But I notice that I often need to pretty print more than one value, and I typically add labels to the values, for example:
(pp (list foo: foo bar: bar))
This is tedious.
Actually I do much the same thing, except that I use the idiom
(pp `((foo ,foo) (bar ,bar)))
or more oftenly, I just use write/newline.
Moreover I often add a call to pp to print the result of a function, and I want the result to be returned so I end up transforming:
(define (square x) (* x x)) => (define (square x) (let ((result (* x x))) (pp result) result))
This *is* tedious, and I do it all the time, too.
So I'm thinking of transforming pp into a special form which automatically adds keyword labels (when no keyword is explicitly given) and returns the value of the last expression.
I did have this once in my personal standard-library. I called it IDEM-PRINT or some such stupid name. So yes, I think you;re looking at something which definitely falls into the 'nice-to-have' category.
Perhaps I shouldn't change pp and instead use a different short name, but which one?
I can't help you here, but PP and PRETTY-PRINT are widely implemented and have expected meanings to those of us who regularly use multiple Scheme implementations, so I would suggest that you find a different name, anyway.
What do you think?
There you have it.
david rush