Add a method get in the object loc defined in Example 6.8 to represent a memory location, so that the field value is accessed by get. In a calculus that combines objects, functions, numbers, and...



Add a method get in the object loc defined in Example 6.8 to represent a


memory location, so that the field value is accessed by get.



In a calculus that combines objects, functions, numbers, and arithmetic


functions, we have defined the following object:


loc = [value = 0,


set = ς(x)λ(n)x.value := n,


incr = ς(x)x.value := x.value + 1]


a) Describe in your own words the behaviour of the methods set and incr.


b) Evaluate the terms (and show the reduction steps)


i. loc.set(1).set(3).value


ii. loc.incr.value


where loc is the object defined above.



May 26, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here