[Haskell-cafe] Haskell Cheat Sheet?

Dan Weston westondan at imageworks.com
Wed Sep 26 20:23:58 EDT 2007


Not to beat a dead horse, but I wasn't suggesting to rename the fix 
function that everyone knows and loves:

fix :: (a -> a) -> a
fix f = let f' = f f' in f'

I was merely trying to suggest that it would be wise to rename the 
function in http://haskell.org/haskellwiki/Reference_card that redefined 
  fix to mean:

  fix :: Eq x => (x -> x) -> x -> x
  fix f x = if x == x' then x else fix f x'
      where x' = f x

It is this latter function which I suggested to be renamed limit, since 
it returns the limit (converged value) of f^n x, where n -> inf, and 
doesn't even have the same type or arity as the standard fix function.

Somehow this (admittedly minor) point got lost in the heat of battle.

Dan Weston

Jonathan Cast wrote:
> On Wed, 2007-09-26 at 17:09 -0500, Derek Elkins wrote:
>> On Wed, 2007-09-26 at 14:12 -0700, Jonathan Cast wrote:
>>> On Wed, 2007-09-26 at 11:43 -0700, Dan Weston wrote:
>>>> It seems no one liked idea #2. I still think fix is the wrong name for 
>>>> this, maybe limit would be better.
>>> It calculates least fixed points.  `fix' is as good a name as any.
>>>
>>> `limit' is terrible; the argument to fix, a -> a, is neither a sequence
>>> nor diagram nor net type, and hence its values don't have limits...
>>>
>>> jcc
>>>
>>> PS Yes, I know fix a = sup_{i=0}^inf f^i(bot).  That sequence is rather
>>> different than the input function...
>> Actually, f :: a -> a -is- a diagram and its limit -is- fix f.
> 
> In what way?  I'm not disputing you, but I don't see how to interpret it
> as such.
> 
>>   That
>> said, limit is still a horrible name for it.  fix isn't much better, and
>> Y is even worse.  I'm not sure what an immediately intuitive name would
>> be, so might as well go with the historical one.
> 
> recursive (at least for my usage).
> 
> jcc
> 
> 
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
> 
> 




More information about the Haskell-Cafe mailing list