[Haskell-beginners] fix

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Wed Oct 15 19:09:24 EDT 2008

On 2008 Oct 15, at 19:04, Brandon S. Allbery KF8NH wrote:
> On 2008 Oct 15, at 18:51, Matthew J. Williams wrote:
>> 	Yet, it does not quite explain how 'fix' does not result in  
>> infinite recursion.
> Remember, Haskell is non-strict.  When the computation reaches 0,  
> the "then" branch of the conditional is evaluated and the "else" is  
> unneeded and therefore ignored, so its re-invocation isn't seen.

Think about this, btw:  you can create new control operations as  
ordinary functions  In strict languages you need to rely on special  
syntax (such as Perl's IO syntax + \& prototype, or Ruby's special  
block/proc syntax; in LISP/Scheme, you have to use a macro and/or  
quoting); non-strict evaluation gives it to you for free.

brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH

More information about the Beginners mailing list