[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: format equivalent of printf "%3.1f", "%03x"

From: Keith Wright
Subject: Re: format equivalent of printf "%3.1f", "%03x"
Date: Tue, 16 Oct 2001 01:33:54 -0400

> From: Steve Tell <address@hidden>
> Does guile's (format) procedure from (ice-9 format) provide a way to
> control the field width and number of decimal places with a ~f conversion,
> by analogy to:
>       printf("%4.1f", 1.267) -> " 1.3"

guile> (format #f "like this (~4,1f)" 1.267)
"like this ( 1.3)"

> And also, how do I get leading zeros for hex printing of integers
> as in "04x"?   

guile> (format #f "like this (~4,'0x)" 2561)
"like this (0a01)"

> Alternately, has anyone ever implemented a printf procedure for guile (or
> failing that, any scheme, I suppose) that is a full-featured superset of
> C's printf?

Boy are you asking for flamage.  Ask again when you are ready for
a quiz on pages 581-608 of Common Lisp: The Language
by Guy L. Steele Jr. (Digital Press)

I bet you are asking for an empty-featured subset before you are done.

But _is_ missing some details, like how to specify
arguments and, in many cases, what they mean.

     -- Keith Wright  <address@hidden>

Programmer in Chief, Free Computer Shop <>
         ---  Food, Shelter, Source code.  ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]