[Haskell-cafe] Detecting Cycles in Datastructures

Benjamin Franksen benjamin.franksen at bessy.de
Fri Nov 18 20:27:06 EST 2005


On Saturday 19 November 2005 02:16, Greg Woodhouse wrote:
> --- jerzy.karczmarczuk at info.unicaen.fr wrote:
> > fix f = f (fix f)   -- Here you have your Y. No typeless lambda.
> >
> > g f n = n : f n    -- This is a generic *non-recursive* `repeat`
> > ones = fix g 1     -- Guess what.
>
> Very nice! I honestly would not have expected this to work. Simple
> cases of lazy evaluation are one thing, but this is impressive.

[You should read some of his papers, for instance "the most unreliable 
techique in the world to compute pi". I was ROTFL when I saw the title 
and reading it was an eye-opener and fun too.]

Ben


More information about the Haskell-Cafe mailing list