HP Wei wrote:
I hit a metal block when trying to understand
Figure 9.3 in chapter 9 in the Tutorial of Oz on the mozart web site.

Here is the snippet that I copied from Figure 9.3 (with irrelevant part deleted).

declare P S in
local
  Tag = {NewName}
  fun {NewPort S}
     C = {NewCell S} in
     {NewChunk port(Tag:C)}
  end
  proc {Send P M}
     Ms Mr in
     {Exchange P.Tag Ms Mr}
     %%% point C
     Ms = M|Mr  %%% point D
  end
in
  P = {NewPort S}
  {Send P 1} %%% point A
  {Send P 2} %%% point B
end

------------------------------------
At point A,  S contains  "1"|_
After point B,  S contains "1"|"2"|_

It is at the point C and D that I could not figure out what happened.
Suppose we are at point B when {Send P 2} is just invoked.
When the process reaches point C,
  I thouhgt  S should contain "1"|_
  then  Ms should be bind to "1"|_
  and Mr is bind to "|_   and M is bind to "2"
Does the Exchange function do the exchange at this point ?
  i.e.
  S becomes "|_

what happens at point D ?
 [ i.e.  I don't follow the statement D with the above bindings!! ]

More newbie I am but...

In the cell P.Tag there is always a new unbounded namely Mr
The exchange then is made between old and new unboundends.
Finally the old unbounded is set to a new list made of message+new_unbounded.Who ever was referring the old unbounded is having
the massage concat with the new unbounded from now on.
By induction my mind derives it works, but I hope good masters help you (and I) more.

Ciao
Paolino


                
___________________________________ Yahoo! Messenger: chiamate gratuite in tutto il mondo http://it.messenger.yahoo.com


_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to