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

From: Richard Cleis (rcleis at mac.com)
Date: Wed May 12 11:08:34 EDT 2004

Thanks for the idea, tho; it's a good start.  I've been cheating by 
writing c-primitives that accept a string format from scheme.

rac


On May 12, 2004, at 8:55 AM, John Clements wrote:

>
> On May 12, 2004, at 10:51 AM, Jens Axel Søgaard wrote:
>
>>  For list-related administrative tasks:
>>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>
>> John Clements wrote:
>>
>> > (define (limit-digits x num)
>>     (let ([y (expt 10 x)])
>>       (number->string (/ (exact->inexact (round (* num y))) y))))
>>
>> > (limit-digits 0 3)
>> "3.0"
>>
>> > (limit-digits 1 2)
>> "2.0"
>>
>> > (limit-digits 2 2)
>> "2.0"
>
> Yes, of course you're right.  I take it all back.
>
> john "back to real work" clements
>



Posted on the users mailing list.