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
