CTM: Exercise 4-5

Posted by Urban Hafner Wed, 02 Nov 2005 16:13:41 GMT

The problem

The Wait operation. Explain why the {Wait X} operation could be defined as:

proc {Wait X}
   if X==unit then skip else skip end
end

Use your understanding of the dataflow behavior of the if statement and == operation.

My solution

The idea of Wait is to wait until its argument become bound. The == (i.e. the entailment check) is used to make the procedure wait. The if statement is needed, because == returns a value but Wait doesn’t. To get rid of this value you simply wrap the call to == in an if statement and let the if return nothing.

Tags , , , , , ,

Comments are disabled