[Haskell-cafe] code example

Scott Turner p.turner at computer.org
Sun Dec 19 19:30:51 EST 2004


On 2004 December 19 Sunday 17:31, armin langhofer wrote:
> this is the use:
> ================
> Prelude> :l e:\haskell\burstall.hs
> Main> fix square 0.01
> 0.01

> it seems that i dont have a clue how it works. maybe some of you could
> explain it to me that i can pass the exam tomorrow,

Do you know what "fix square" would do with other argument values?  If not, it 
would be worth your while to look at a whole lot more arguments because the 
results could be illuminating.  Also, try replacing "square" with some other 
functions like "id" or (\x -> x - 1) respectively.

Consider the value of the expression
    abs(f x -x) <= 0.01
if the function parameter "f" is "square".  What values of x would produce a 
True or a False result?  You'll find a close relationship between this 
question and the result of evaluating "fix square ...".


More information about the Haskell-Cafe mailing list