🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #6732

Re: What is Lazy Evaluation?

#6732
From: Vinod Grover
Date: Fri, 16 Feb 1990 02:50
17 lines
1215 bytes
In article <6081@bd.sei.cmu.edu> firth@sei.cmu.edu (Robert Firth) writes:
>
>Example:
>
>	munge(1/x)
>
>greedy evaluation will evaluate 1/x and then call munge().  lazy
>evaluation will call munge(), and evaluate 1/x only when the body
>of munge referenced its formal parameter.
>
>As the example shows, lazy evaluation "works" in cases where greedy
>evaluation does not - in this case, if x=0 but munge doesn't reference
>its parameter.

Lazy Evaluation differs fromn call-by-name in that the expression is
evaluated at-most-once. If there are multiple refrences to 1/x, in the above
example, only one of them will be evaluated if needed.
Technical Details
Message-ID: <131929@sun.Eng.Sun.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!seismo!sundc!newstop!sun!brahmand!grover
References: <3109@caesar.cs.montana.edu> <6081@bd.sei.cmu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!seismo!sundc!newstop!sun!brahmand!grover
From: grover@brahmand.Sun.COM (Vinod Grover)
Newsgroups: comp.lang.misc
Subject: Re: What is Lazy Evaluation?
Keywords: expression evaluation, lazy evaluation
Message-ID: <131929@sun.Eng.Sun.COM>
Date: 16 Feb 90 02:50:02 GMT
References: <3109@caesar.cs.montana.edu> <6081@bd.sei.cmu.edu>
Sender: news@sun.Eng.Sun.COM
Reply-To: grover@sun.UUCP (Vinod Grover)
Distribution: usa
Organization: Sun Microsystems, Mountain View
Lines: 17