[plt-scheme] Fwd: [Lisp] MzScheme string formatting

From: Jos Koot (jos.koot at telefonica.net)
Date: Sat May 24 15:48:09 EDT 2008

May be  http://www.telefonica.net/web2/koot/fmt.zip can be useful for you.
If you like another file format (or anotrher format instr), please let me 
now.
Jos


----- Original Message ----- 
From: "Paul A. Steckler" <stecksoft at gmail.com>
To: <plt-scheme at list.cs.brown.edu>
Sent: Saturday, May 24, 2008 9:26 PM
Subject: [plt-scheme] Fwd: [Lisp] MzScheme string formatting


> Forwarded from the LispNYC list.  I told the poster to try plt-scheme,
> but here's his message in case he doesn't.
>
> -- Paul
>
> ---------- Forwarded message ----------
> From: Arkady Andrukonis <grazingcows at yahoo.com>
> Date: Sat, May 24, 2008 at 12:06 PM
> Subject: [Lisp] MzScheme string formatting
> To: lisp <lisp at lispnyc.org>
>
>
> Hi,
>
> Does anyone have a reference for MzScheme format
> string patterns for formatting decimal output? The
> online reference does not seem have the format-string
> magic.
>
> (printf format-string input ...) or (format
> format-string input ...)
>
> For example,
>
> ;; format decimal to 2 places in Java printf("%.2d")
> ;; MzScheme produces the following
> (- 0.9876 0.9865) -> 0.001099999999999899
> ;; this one does not work
> (format "~w,2F~%" (- 0.9876 0.9865)) ; white space not
> allowed
> ;; this is legal Scheme
> (format "~8,2F" 1/3) -> "        0.33" ; padded with 8
> spaces, not in MzScheme
> ;; we can print numbers as binary, octal, or
> hexadecimal
> (printf "#b~b #o~o #b~b ~%" 16 8 2) -> #x10 #o10 #b10
> ;; or inexact->exact
> (inexact->exact (- 0.9876 0.9865)) ->
> 9907919180215/9007199254740992
> ;; how about formatting decimals?
>
> Thanks,
>
> RKD
>
>
>
> _______________________________________________
> Lisp mailing list
> Lisp at lispnyc.org
> http://www.lispnyc.org:8080/mailman/listinfo/lisp
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme 



Posted on the users mailing list.