[racket] Is there anything like the cl format?

From: Manfred Lotz (manfred.lotz at arcor.de)
Date: Fri Dec 17 03:21:43 EST 2010

Hi Neil,

On Fri, 17 Dec 2010 02:33:00 -0500
Neil Van Dyke <neil at neilvandyke.org> wrote:

> Manfred Lotz wrote at 12/17/2010 01:58 AM:
> [...]
> >> (format t "~,5f" pi)
> >>     
> [...]
> > Is there anything similar to CL's format in Racket?
> >   
> It would be nice to have a some special support for decimal-point 
> formatting in Racket's "format".  Just the number of decimal places
> to print would be nice.  (Other formatting, such as whitespace
> padding, is a lot less relevant now that we use HTML and graphics
> languages rather than ASCII text with fixed-pitch characters for
> formatting.  And I woudn't want CL's "format" -- I recall thinking it
> was an overpowered minilanguage to be stuffing into a string.)

I agree thas cl's format is a swiss knife. Not all of its features is
really required. However, having support for a certain subset of cl'
format features would be nice. The syntax should be either like format
using tilde specifiers or like C's printf using percent specifiers.

> If nobody steps up to the plate for number formatting, I will make a 
> PLaneT package out of some code in my Racket invoicing setup.  This
> code defines special syntax for defining individual number formatters
> (for, e.g., printing US dollars and cents in a conventional US
> style).  It's not the end-all-be-all, which is why I haven't
> PLaneT-ized it already, but it's done what I've needed so far.

Thanks, that would be great.


Posted on the users mailing list.