[plt-scheme] C-style Printf Format Convention?

From: Jean-Pierre Lozi (jean-pierre at lozi.org)
Date: Wed May 12 03:36:55 EDT 2004

In fact format returns the result as a string. To write it to the 
standard output you should use (printf format-string arguments) instead.

Anyway I don't think this solves the problem of choosing accurately the 
right number of digits of a floating point number as you can do in C.

ifconfig wrote:

>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> 
> (format "This string is formatted. Newline: ~n; display: ~a; write: ~s;
> print: ~v; binary: ~b; octal: ~o; hexadecimal: ~x; tilde: ~~; search the
> held desk for \"format\" for more details." "thing to display" "thing to
> write" "thing to print" 100 100 100)
> -->
> This string is formatted. Newline: 
> ; display: thing to display; write: "thing to write"; print: "thing to
> print"; binary: 1100100; octal: 144; hexadecimal: 64; tilde: ~; search the
> held desk for "format" for more details.
> 
> 
> 
>>-----Original Message-----
>>From: plt-scheme-admin at list.cs.brown.edu [mailto:plt-scheme-
>>admin at list.cs.brown.edu] On Behalf Of Brent Fulgham
>>Sent: Wednesday, May 12, 2004 12:05 AM
>>To: PLT Scheme
>>Subject: [plt-scheme] C-style Printf Format Convention?
>>
>>  For list-related administrative tasks:
>>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>
>>Is there a PLT string format function that works like
>>the C printf?
>>
>>My goal is to be able to print a number with an
>>arbitrary
>>number of digits, regardless of its actual magnitude:
>>
>>e.g.,:
>>
>>printf("%-10.5d", 1.23);
>>
>>=> 1.2300
>>
>>Is there a formatting utility I can use for this?
>>
>>Thanks,
>>
>>-Brent
> 
> 

-- 
Jean-Pierre Lozi
mailto:jean-pierre at lozi.org
http://www.lozi.net


Posted on the users mailing list.