On Thursday 26 July 2007, Harald ROTTER wrote: > Hi, > > I read about the usage of "fix" to define recursive functions. Although I > think that I understood how to use "fix", I still wonder what the > advantages of "fix" are (as compared to the "conventional" approach to > define recursive functions).
As others have said, it allows you to define anonymous recursive functions (not necessarily small!). FPers have traditionally advocated using lots of small, named, top-level functions, but I think it's amazing how much more readable code becomes when some of those single-use functions are inlined. You can't inline a recursive function, but you can inline an application of fix. Jonathan Cast http://sourceforge.net/projects/fid-core http://sourceforge.net/projects/fid-emacs
pgpmuHDVlwwsm.pgp
Description: PGP signature
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe