{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Homework 4: On Laziness

How to Design Programs: An Introduction to Programming and Computing

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
WPI CS536 (F07) Homework 4 CS 536 Homework 4: On Laziness Due: October 4, hardcopy in class Problem 1 In our lazy interpreter, we identified three points in the language where we need to force evaluation of expression closures (by invoking strict ): the function position of an application, the test expression of a conditional, and arithmetic primitives. Doug Dolittle, a fairly sedentary student, is rather taken with the idea of laziness. He suggests that we can reduce the amount of code we need to write by replacing all invocations of strict with just one. In the lazy interpreter from class (PLAI chapter 8), he removes all instances of strict and replaces [id (v) (lookup v env)] with [id (v) (strict (lookup v env))] Doug s reasoning is that the only time the interpreter returns an expression closure is on looking up an identifier in the environment. If we force its evaluation right away, we can be sure no other part of the interpreter will get an expression closure, so removing those other invocations of strict will do no harm.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 2

Homework 4: On Laziness - WPI CS536(F07 Homework 4 CS 536...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon bookmark
Ask a homework question - tutors are online