Anyway, these functions do not get the least fixed point ot r, but a fixed point of f starting from the seed x. it is&#39;n?<div><br><div><a href="http://en.wikipedia.org/wiki/Fixed_point_(mathematics)">http://en.wikipedia.org/wiki/Fixed_point_(mathematics)</a></div>
<div><br></div><div><br></div><div><div class="gmail_quote">2009/3/19 Neil Mitchell <span dir="ltr">&lt;<a href="mailto:ndmitchell@gmail.com">ndmitchell@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">&gt; I&#39;ve used a similar function myself, but why write it in such a complicated<br>
&gt; way? How about<br>
&gt;<br>
&gt; lfp :: Eq a =&gt; (a -&gt; a) -&gt; a -&gt; a<br>
&gt; lfp f x<br>
&gt;  | f x == x = x<br>
&gt;  | otherwise = lfp f (f x)<br>
<br>
</div>I&#39;ve used a similar function too, but your version computes f x twice<br>
per iteration, I wrote mine as:<br>
&#39;t<br>
fix :: Eq a =&gt; (a -&gt; a) -&gt; a -&gt; a<br>
fix f x = if x == x2 then x else fix f x2<br>
    where x2 = f x<br>
<br>
I find this fix much more useful than the standard fix.<br>
<br>
Thanks<br>
<font color="#888888"><br>
Neil<br>
</font><div><div></div><div class="h5">_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br></div></div>