[Haskell-cafe] Lazy evaluation from "Why Functional programming matters"

C K Kashyap ckkashyap at gmail.com
Tue Oct 5 07:20:30 EDT 2010


Hi All,

I was going through the paper's "lazy evaluation" section where the
square root example is given. It occurred to me that one could
implement it in a modular way with just higher order functions
(without the need for lazy evaluation that is).


function f (within, eps, next, a0){
   while(true){
    a1=next(a0);
    if(within(a0,a1,eps)return a0;
   a0=a1;
   }
}

Is this not the case?

-- 
Regards,
Kashyap


More information about the Haskell-Cafe mailing list