Obviously, I have to object to "they always run for worst-documented
feature": if any, spaces are the most widely published concepts in Oz and
one of the rather few to which an entire book is devoted! Use the book!

Christian


--
Christian Schulte, http://www.imit.kth.se/~schulte/ 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Sukit Tretriluxana
Sent: Monday, May 01, 2006 10:03 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: The code block


Thank you very much Jorge. That's very helpful.

Ed


On 5/1/06, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote:

Hi there!

> I am a newbie in Oz and Mozart. I am following a tutorial on logic 
> programming. Part of it states that the following code can execute without
> blocking if it is called determistically.

That is true provided you make a call inside a space. Actually, dis can
never be 
used in the toplevel space because the latter never gets stable and dis
implicitly calls Space.waitStable.

Thus:
--------------
declare
proc {FullAppend L1 L2 L3}
   dis L1=nil L2=L3
   [] X M1 M3 in 
      L1=X|M1 L3=X|M3 {FullAppend M1 L2 M3}
   end
end
fun {MergeAfterStable S}
   {Space.ask S _}
   {Space.merge S}
end

{Browse {MergeAfterStable {Space.new fun {$} {FullAppend [1 2] [3 4]} end}}}

--------------

does the job. Beware that calling Space.waitStable poses somes constraints
on
the use of dis. For example, it cannot be called by a thread if another
thread
is calling Space.waitStable... That's life, or rather, that's one of the
things 
that make learning about spaces such a must in Oz, though they always run
for
worst-documented feature :o) I mean, there is no space tutorial.

A common procedure: keep on trying to ignore spaces - or learn as little as 
possible - till they finally impose themselves. People on the list will
always
be there to help you out!

Cheers,

Jorge.


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

Reply via email to