tag:bettong.net,:/tag/wait Urban Hafner : Tag wait, everything about wait 2007-05-08T08:01:12+00:00 Typo tag:bettong.net,:Article/63 2005-11-02T16:13:41+00:00 2007-05-08T08:01:12+00:00 Urban Hafner CTM: Exercise 4-5

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.

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.