[plt-scheme] Printing

From: Matt Jadud (mcj4 at kent.ac.uk)
Date: Sat Oct 15 04:34:31 EDT 2005

I'd like to remind everyone that, had I learned my lessons, I would have

1. First written a contract and purpose statement.
2. A header.
3. Test cases.
4. The code.

Alas, I have not followed the One True Way.

:(

M

PS. Ouch. You got me. I can just about see Bart Simpson writing "I will 
not write Scheme code first thing in the morning" over and over right 
now. :)

Jens Axel Søgaard wrote:
> Matt Jadud wrote:
> 
>> You could do:
>>
>> (define (decimal-places n places)
>>   (* 1.0 (/ (floor (* n (expt 10 places))) (expt 10 places))))
>>
>> ... or something similar. I thought there was some kind of 
>> interpolation library in Planet that allowed something like your first 
>> example? (I could be making that up, though.)
> 
> 
> I am getting a deja vu.
> 
> Is this intended?
> 
>  > (decimal-places -0.04 1)
> -0.1
> 
> 


Posted on the users mailing list.