Sunday, February 1, 2009

Ch4, Ex8

a)It'll block as {F A} can't be evaluated unless A is bound and hence call to {F A} blocks, which in turn blocks the if statement.Since Filter is blocked so Show is never executed and hence nothing comes on the display.

b) On my computer, Running it always shows "Out<optimized>". But actually it can also show 5|_<optimized> depending upon how busy the computer is, which introduces a delay between thread starting and {Show Out} call. Filter is deterninistic because any consumer using the stream produced by it will *always* get the *same* stream. The reason that we see various values coming out of Show is probably not because of Filter but because of Show. Show is not deterministic.

c)This always shows 5|_<optimized> because of the explicit delay introduced.

d) This shows [5 6 4] because both the threads finish running before {Show Out} is called because of the explicit delay introduced.

Note: {Show arg} shows arg on buffer *Oz Emulator* and not in Oz Browser.

No comments:

Post a Comment