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

2010-10-05 Thread C K Kashyap
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){

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

2010-10-05 Thread Hemanth Kapila
Hi, Let us try to rewrite the code in a more java-esque syntax: It translates to something like the below generic method. Correct? static T T function(IBoundsCheckT within, DeltaT eps, IteratorT iterator, T initValue){ T currVal = initVal; while(iterator.hasNext()){ T nextVal

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

2010-10-05 Thread C K Kashyap
Hi, Let us try to rewrite the code in a more java-esque syntax: It translates to something like the below generic method. Correct? static T T function(IBoundsCheckT within, DeltaT eps,  IteratorT iterator, T initValue){       T currVal = initVal;     while(iterator.hasNext()){         T

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

2010-10-05 Thread Brent Yorgey
On Tue, Oct 05, 2010 at 07:37:32PM +0530, C K Kashyap wrote: Hi, Let us try to rewrite the code in a more java-esque syntax: It translates to something like the below generic method. Correct? static T T function(IBoundsCheckT within, DeltaT eps,  IteratorT iterator, T initValue){       

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

2010-10-05 Thread Hemanth Kapila
I see ... I think I understand now. hmmm ... I am little disappointed though - does that mean that all the laziness cool stuffs can actually be done using iterators(generators)? As in, but for the inconvenient syntax, you can do it all in - say java? Yes. It would slightly easier in, say,

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

2010-10-05 Thread C K Kashyap
Yes. It would slightly easier in, say,  C# or C++. I think 'D' achieves its implementation of the 'lazy' keyword using a similar approach. But I did not understand why you are disappointed ? The disappointment was not on a serious note ... the thing is, I constantly run into discussions

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

2010-10-05 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/5/10 10:52 , C K Kashyap wrote: And I had built up this impression that laziness distinguished Haskell by a huge margin ... but it seems that is not the case. Hence the disappointment. Haskell is lazy-by-default and designed around lazy