Extend the Definelang programming language from this chapter such that it supports a variation of the define
Question:
Extend the Definelang programming language from this chapter such that it supports a variation of the define declaration, say ldefine declaration (short for “lazy define”). In a regular define declaration in an expression such as the following, first the value of the expression (/ (* n R T) V) is computed, and then the global environment is extended with a mapping from name P to this value:
In a lazy define declaration, the value of the expression (/ (* n R T)
V) will be computed when the name P is used. An example appears here:
Notice that the interaction given here would not have worked with the regular define declaration because the names n, R, T, and V would not be defined. In the lazy define declaration, since the value of the expression (/ (* n R T) V) is computed when P is looked up, the interaction works.
Step by Step Answer:
An Experiential Introduction To Principles Of Programming Languages
ISBN: 9780262045452
1st Edition
Authors: Hridesh Rajan