[racket] ~r behavior with respect to the sign

From: Eli Barzilay (eli at barzilay.org)
Date: Wed Jan 15 07:52:52 EST 2014

Yesterday, Ryan Culpepper wrote:
> 
> The behavior is intentional, because you can change the padding 
> character, and "-  123" seems more useful (for blank padding) than 
> "00-123" (for 0 padding).

IMO, this is a major mistake, since space-padding is far more popular
(and this is actually recognized by the interface that uses it as a
default).  So I think that it's perfectly file to expect a "00-123"
result when padding with "0" -- and instead you need to do the padding
yourself in that (much rarer) case.


Yesterday, Dmitry Pavlov wrote:
> 
> What do you think will be a good interface here?  You can suggest an
> extension of interface to ~r and I will try and spend a couple of
> hours writing a patch.

At some point I suggested changing the current behavior to pad as
you'd expect, and add another option of supplying a 0 (the number) as
the pad to get the between-the-minus-and-the-number kind of padding.
But this is going to look odd with a keyword that is called
`pad-string'.


(But together with the extreme verbosity, and the inability to do more
general output for large quantities, I think that the format library
is far from ideal...)

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the users mailing list.