🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #6712

What is Lazy Evaluation?

#6712
From: Lou Glassy
Date: Tue, 13 Feb 1990 18:17
26 lines
1549 bytes
What does 'lazy evaluation' mean?  Is it the same thing as 'short-circuit evaluation?

An example of the latter:

x=0;
if ( (x==1) && ((1/x) == 2) )
{
   ...
}

If short-circuit evaluation is in effect, the expression '1/x' will never be
evaluated, since the && will return a false directly from 'x==1'.

Is -this- the same thing as 'lazy evaluation' in functional languages?  I suspect there's a difference...but what? A matter of degree?

My confusion arises from a kindred (opposite) idea, that of 'eager evaluation'.
If the example above were evaluated eagerly, '1/x' would yield a division-by-zero error.  And...I thought 'eager' was the opposite of 'lazy', in terms of evaluation methods.

Can someone clarify 'eager' vs. 'strict' vs. 'lazy' vs. 'short-circuit' 
evaluation for me?  Or tell me of a good reference (book/article/etc) on 
these things?

Thanks in advance.

Lou Glassy
icsu8209@caesar.cs.montana.edu
Technical Details
Message-ID: <3109@caesar.cs.montana.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uunet!aplcen!uakari.primate.wisc.edu!caesar.cs.montana.edu!icsu8209

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uunet!aplcen!uakari.primate.wisc.edu!caesar.cs.montana.edu!icsu8209
From: icsu8209@caesar.cs.montana.edu (Lou Glassy)
Newsgroups: comp.lang.misc,msu.cs.general
Subject: What is Lazy Evaluation?
Keywords: expression evaluation, lazy evaluation
Message-ID: <3109@caesar.cs.montana.edu>
Date: 13 Feb 90 18:17:17 GMT
Sender: news@caesar.cs.montana.edu
Reply-To: icsu8209@caesar.cs.montana.edu (Glassy)
Followup-To: comp.lang.misc
Distribution: usa
Organization: Montana State University, Dept. of Computer Science, Bozeman MT 59717
Lines: 26