[plt-scheme] call-by-value vs. call-by-name?
You need to manage the laziness. Say your argument is 3 + 5. How many
instructions is it to evaluate this twice? How many instructions is
it to build a delayed computation, run it when needed, store the
result, retrieve the result when needed? Are you sure you're saving
*anything*? Turns out you don't, in most cases. And then reason about
space.
Please read the paper. -- Matthias
On Jan 30, 2008, at 10:13 PM, Benjamin L. Russell wrote:
> Which paper from FPCA 1995
> (http://www.informatik.uni-trier.de/~ley/db/conf/fpca/fpca95.html)
> are you referring to? Is it the one from Session 7,
> by Klaus E. Schauser and Seth Copen Goldstein,
> entitled "How Much Non-Strictness do Lenient Programs
> Require?"
>
> I haven't read the relevant paper yet, so I would need
> to read it first to be sure, but it would seem to be
> the case that if a function had a statement that,
> under call-by-value, would require evaluating multiple
> arguments, and, under call-by-need, would require
> evaluating only a single argument, the call-by-need
> version could run faster.
>
> Is there some other reason that it is not true that
> everything ought to be lazy?
>
> Benjamin L. Russell
>
> --- Matthias Felleisen <matthias at ccs.neu.edu> wrote:
>
>>
>> On Jan 28, 2008, at 2:08 PM, Shu-yu Guo wrote:
>>
>> [snip]
>> Once again, the idea that everything ought to be
>> lazy has been
>> debunked, see FPCA 1995. The quick summary is that
>> if you look at any
>> large code basis you realize that you definitely do
>> want lazy
>> constructors but lazy functions is an entirely
>> different thing. As
>> far as I can tell, people who are willing to look at
>> this from a
>> reasonably neutral effort have come to agree that
>> the examples that
>> demonstrate the need for lazy functions are toy
>> examples.
>> [snip]