[clean-list] Exercise from Clean book

Daniel Yokomiso daniel_yokomiso@yahoo.com.br
Wed, 17 Sep 2003 21:14:56 -0300


Hi,

    Thanks. As I see the message is dated from july 2001. Will this be
corrected? IMO if it isn't at least there should be a big warning in the
Clean Book. It's a very strange bug, as simple changes in the code make it
go away. The following works:


smallest = until (hack is_zero tenth) tenth 1.0
    where hack f g = (f o g)
          is_zero x = x == 0.0


but if we inline "hack" it stops working:


smallest = until (is_zero o tenth) tenth 1.0
    where is_zero x = x == 0.0


    Best regards,
    Daniel Yokomiso.

"Beauty is the first test: there is no permanent place in this world for
ugly mathematics."
- G. H. Hardy, A Mathematician's Apology


----- Original Message ----- 
From: "Ronny Wichers Schreur" <ronny@cs.kun.nl>
To: <clean-list@cs.kun.nl>
Sent: Wednesday, September 17, 2003 8:58 AM
Subject: Re: [clean-list] Exercise from Clean book


> Daniel Yokomiso writes (to the Clean discussion list):
>
> >[..]
> >expected = last (takeWhile ((<>) 0.0) (iterate (\x -> x/10.0) 1.0))
> >smallest = until (\x -> tenth x == 0.0) tenth 1.0
> >tenth x  = x/10.0
> >
> >Start = expected == smallest
> >
> >
> >    After running it the system gives me "False". [..]
> >
> This is a rounding issue. See
> <http://www.cs.kun.nl/pipermail/clean-list/2001/001639.html>.
>
>
> Cheers,
>
> Ronny Wichers Schreur



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.518 / Virus Database: 316 - Release Date: 11/9/2003