Ex 9.9 in Paul Hudak's book
Tom Bevan
tom@regex.com.au
Wed, 3 Apr 2002 16:43:12 +1000
I've been watching the discussion of the fixed point function with intere=
st.
In Antony's example,
> factGen =3D \f -> \n -> if n=3D=3D0 then 1 else n * f (n-1)
The fixed point of factGen is clearly n! because
0! =3D 1=20
and
n! =3D n * (n-1) * (n-2) * .. * 1 =3D n * ( (n-1)! ) =3D n * f (n-1)
so the factGen transformation simply maps=20
the factorial function back onto itself.
What I would like to know is how the 'fix' function could be used
to find the fixed point of a function like ( \n -> 2*n ).
If it isn't possible, can someone explain the crucial difference between=20
n! and (\n -> 2*n ) which allows n factorial to be found via the fix poin=
t=20
method and not zero.
Tom