/usr/share/mozart/doc/system/node45.html is in mozart-doc 1.4.0-8ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>10 First-class Computation Spaces: Space</TITLE><LINK href="ozdoc.css" rel="stylesheet" type="text/css"></HEAD><BODY><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node44.html#chapter.combinator"><< Prev</A></TD><TD><A href="index.html">- Up -</A></TD><TD><A href="node46.html#chapter.dp">Next >></A></TD></TR></TABLE><DIV id="chapter.space"><H1><A name="chapter.space">10 First-class Computation Spaces: <CODE>Space</CODE></A></H1><P>First-class computation spaces can be used to program inference engines for problem solving. </P><DL><DT><A name="label482"></A><SPAN class="index"><CODE>is</CODE></SPAN> <A name="label484"></A></DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>{Space<SPAN class="keyword">.</SPAN>is </CODE><CODE>+<I>X</I></CODE><CODE> </CODE><CODE>?<I>B</I></CODE><CODE>}</CODE></P></BLOCKQUOTE></DD><DD><P>tests whether <CODE><I>X</I></CODE> is a space. </P></DD><DT><CODE>new</CODE> <A name="label486"></A></DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>{Space<SPAN class="keyword">.</SPAN>new </CODE><CODE>+<I>P</I></CODE><CODE> </CODE><CODE>?<I>Space</I></CODE><CODE>}</CODE></P></BLOCKQUOTE></DD><DD><P>returns a newly created space, in which a thread containing an application of the unary procedure <CODE><I>P</I></CODE> to the root variable of <CODE><I>Space</I></CODE> is created. </P></DD><DT><CODE>ask</CODE> <A name="label488"></A></DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>{Space<SPAN class="keyword">.</SPAN>ask </CODE><CODE>+<I>Space</I></CODE><CODE> </CODE><CODE>?<I>T</I></CODE><CODE>}</CODE></P></BLOCKQUOTE></DD><DD><P>waits until <CODE><I>Space</I></CODE> becomes stable or merged and then returns the status of <CODE><I>Space</I></CODE>. </P><P>If <CODE><I>Space</I></CODE> is merged, the atom <CODE>merged</CODE> is returned.</P><P>If <CODE><I>Space</I></CODE> is stable and: </P><DL><DT>failed</DT><DD><P>the atom <CODE>failed</CODE> is returned.</P></DD><DT>succeeded</DT><DD><P>and there are no threads in <CODE><I>Space</I></CODE> synchronizing on choices, the atom <CODE>succeeded</CODE> is returned.</P></DD><DT>succeeded</DT><DD><P>and there is at least one thread in <CODE><I>Space</I></CODE> which synchronizes on a choice the tuple <CODE>alternatives(</CODE><I>I</I><CODE>)</CODE> is returned, where <I>I</I> gives the number of alternatives of the selected choice.</P></DD></DL><P> </P><P>Synchronizes on stability of <CODE><I>Space</I></CODE>. </P><P>Raises a runtime error if the current space is not admissible for <CODE><I>Space</I></CODE>. </P></DD><DT><CODE>askVerbose</CODE> <A name="label490"></A></DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>{Space<SPAN class="keyword">.</SPAN>askVerbose </CODE><CODE>+<I>Space</I></CODE><CODE> </CODE><CODE>?<I>T</I></CODE><CODE>}</CODE></P></BLOCKQUOTE></DD><DD><P>returns the status of <CODE><I>Space</I></CODE> in verbose form. Reduces immediately, even if <CODE><I>Space</I></CODE> is not yet stable.</P><P>If <CODE><I>Space</I></CODE> becomes merged, the atom <CODE>merged</CODE> is returned.</P><P>If <CODE><I>Space</I></CODE> becomes suspended (that is, blocked but not stable), <CODE><I>T</I></CODE> is bound to the tuple <CODE>suspended(</CODE><I>T1</I><CODE>)</CODE>. <I>T1</I> is a future that is bound to the status of <CODE><I>Space</I></CODE> when <CODE><I>Space</I></CODE> becomes unblocked again.</P><P>If <CODE><I>Space</I></CODE> is stable and: </P><DL><DT>failed</DT><DD><P>the atom <CODE>failed</CODE> is returned.</P></DD><DT>succeeded</DT><DD><P>and there are no threads in <CODE><I>Space</I></CODE> synchronizing on choices, the tuple <CODE>succeeded(</CODE><I>A</I><CODE>)</CODE> is returned. The atom <I>A</I> is either <CODE>stuck</CODE>, when <CODE><I>Space</I></CODE> still contains threads, or <CODE>entailed</CODE> otherwise. </P></DD><DT>succeeded</DT><DD><P>and there is at least one thread in <CODE><I>Space</I></CODE> which synchronizes on a choice the tuple <CODE>alternatives(</CODE><I>I</I><CODE>)</CODE> is returned, where <CODE><I>I</I></CODE> gives the number of alternatives of the selected choice. </P></DD></DL><P> </P><P>Does not synchronize on stability of <CODE><I>Space</I></CODE>. </P><P>Raises a runtime error if the current space is not admissible for <CODE><I>Space</I></CODE>. </P></DD><DT><CODE>merge</CODE> <A name="label492"></A></DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>{Space<SPAN class="keyword">.</SPAN>merge </CODE><CODE>+<I>Space</I></CODE><CODE> </CODE><CODE><I>X</I></CODE><CODE>}</CODE></P></BLOCKQUOTE></DD><DD><P>merges <CODE><I>Space</I></CODE> with the current space and constrains <CODE><I>X</I></CODE> to the root variable of <CODE><I>Space</I></CODE>. </P><P>Does not synchronize on stability of <CODE><I>Space</I></CODE>. </P><P>Raises a runtime error if <CODE><I>Space</I></CODE> is already merged, or if the current space is not admissible for <CODE><I>Space</I></CODE>. </P></DD><DT><CODE>clone</CODE> <A name="label494"></A></DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>{Space<SPAN class="keyword">.</SPAN>clone </CODE><CODE>+<I>Space1</I></CODE><CODE> </CODE><CODE>?<I>Space2</I></CODE><CODE>}</CODE></P></BLOCKQUOTE></DD><DD><P>blocks until <CODE><I>Space1</I></CODE> becomes stable and returns a new space which is a copy of <CODE><I>Space1</I></CODE>. </P><P>Synchronizes on stability of <CODE><I>Space</I></CODE>. </P><P>Raises a runtime error if <CODE><I>Space</I></CODE> is already merged, or if the current space is not admissible for <CODE><I>Space</I></CODE>. </P></DD><DT><CODE>inject</CODE> <A name="label496"></A></DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>{Space<SPAN class="keyword">.</SPAN>inject </CODE><CODE>+<I>Space</I></CODE><CODE> </CODE><CODE>+<I>P</I></CODE><CODE>}</CODE></P></BLOCKQUOTE></DD><DD><P>creates a thread in the space <CODE><I>Space</I></CODE> which contains an application of the unary procedure <CODE><I>P</I></CODE> to the root variable of <CODE><I>Space</I></CODE>. </P><P>Does not synchronize on stability of <CODE><I>Space</I></CODE>. </P><P>Raises a runtime error if <CODE><I>Space</I></CODE> is already merged, or if the current space is not admissible for <CODE><I>Space</I></CODE>. </P></DD><DT><CODE>kill</CODE> <A name="label498"></A></DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>{Space<SPAN class="keyword">.</SPAN>kill </CODE><CODE>+<I>Space</I></CODE><CODE>}</CODE></P></BLOCKQUOTE></DD><DD><P>kills a space by injecting failure into <CODE><I>Space</I></CODE>. </P><P>Can be defined by </P><BLOCKQUOTE class="code"><CODE><SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">Space.kill</SPAN> S}<BR> {Space<SPAN class="keyword">.</SPAN>inject S <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> _} <SPAN class="keyword">fail</SPAN> <SPAN class="keyword">end</SPAN>}<BR><SPAN class="keyword">end</SPAN></CODE></BLOCKQUOTE><P> </P><P>Does not synchronize on stability of <CODE><I>Space</I></CODE>. </P><P>Raises a runtime error if <CODE><I>Space</I></CODE> is already merged, or if the current space is not admissible for <CODE><I>Space</I></CODE>. </P></DD><DT><CODE>commit</CODE> <A name="label500"></A></DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>{Space<SPAN class="keyword">.</SPAN>commit </CODE><CODE>+<I>Space</I></CODE><CODE> </CODE><CODE>+<I>IT</I></CODE><CODE>}</CODE></P></BLOCKQUOTE></DD><DD><P>blocks until <CODE><I>Space</I></CODE> becomes stable and then commits to alternatives of the selected choice of <CODE><I>Space</I></CODE>. </P><P>If <CODE><I>IT</I></CODE> is a pair of integers <I>l</I><CODE><SPAN class="keyword">#</SPAN></CODE><I>r</I> then all but the <I>l</I>, <I>l</I> + 1, ..., <I>r</I> alternatives of the selected choice of <CODE><I>Space</I></CODE> are discarded. If a single alternative remains, the topmost choice is replaced by this alternative. If no alternative remains, the space is failed. </P><P>An integer value for <CODE><I>IT</I></CODE> is an abbrevation for the pair <CODE><I>IT</I></CODE><CODE><SPAN class="keyword">#</SPAN></CODE><CODE><I>IT</I></CODE>. </P><P>Synchronizes on stability of <CODE><I>Space</I></CODE>. </P><P>Raises a runtime error, if <CODE><I>Space</I></CODE> has been merged already, if there exists no selected choice in <CODE><I>Space</I></CODE>, or if the current space is not admissible for <CODE><I>Space</I></CODE>. </P></DD><DT><CODE>waitStable</CODE> <A name="label502"></A></DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>{Space<SPAN class="keyword">.</SPAN>waitStable}</CODE></P></BLOCKQUOTE></DD><DD><P>blocks until the current space (the space that hosts the current thread) becomes stable. <CODE>Space<SPAN class="keyword">.</SPAN>waitStable</CODE> is used mainly for programming distribution strategies (see for example <A href="../fdt/node40.html#chapter.user-defined">Chapter 9 of ``Finite Domain Constraint Programming in Oz. A Tutorial.''</A>), where for accurate variable selection it is required that all propagation has been carried out.</P><P>If executed in the toplevel space, it will block forever. </P></DD><DT><CODE>choose</CODE> <A name="label504"></A></DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>{Space<SPAN class="keyword">.</SPAN>choose </CODE><CODE>+<I>I1</I></CODE><CODE> </CODE><CODE>?<I>I2</I></CODE><CODE>}</CODE></P></BLOCKQUOTE></DD><DD><P>blocks until the current space becomes stable. When the current space becomes stable it creates a choice point with <CODE><I>I1</I></CODE> alternatives. <CODE><I>I2</I></CODE> is bound to the value selected by <CODE>Space<SPAN class="keyword">.</SPAN>commit</CODE>. Reduces as soon as <CODE><I>I2</I></CODE> becomes bound. </P><P><CODE>Space<SPAN class="keyword">.</SPAN>choose</CODE> is a primitive intended for programming abstractions. For example, the Mozart-compiler expands the following <CODE><SPAN class="keyword">choice</SPAN></CODE>-statement </P><BLOCKQUOTE class="code"><CODE><SPAN class="keyword">choice</SPAN> </CODE><CODE><I>S1</I></CODE><CODE> <SPAN class="keyword">[]</SPAN> </CODE><CODE><I>S2</I></CODE><CODE> <SPAN class="keyword">end</SPAN></CODE></BLOCKQUOTE><P> to the following statement </P><BLOCKQUOTE class="code"><CODE><SPAN class="keyword">case</SPAN> {Space<SPAN class="keyword">.</SPAN>choose 2}<BR><SPAN class="keyword">of</SPAN> 1 <SPAN class="keyword">then</SPAN> </CODE><CODE><I>S1</I></CODE><CODE> <BR><SPAN class="keyword">[]</SPAN> 2 <SPAN class="keyword">then</SPAN> </CODE><CODE><I>S2</I></CODE><CODE> <BR><SPAN class="keyword">end</SPAN></CODE></BLOCKQUOTE><P> </P><P>If executed in the toplevel space, it will block forever. </P></DD></DL><P> </P></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node44.html#chapter.combinator"><< Prev</A></TD><TD><A href="index.html">- Up -</A></TD><TD><A href="node46.html#chapter.dp">Next >></A></TD></TR></TABLE><HR><ADDRESS><A href="http://www.ps.uni-sb.de/~duchier/">Denys Duchier</A>, <A href="http://www.ps.uni-sb.de/~kornstae/">Leif Kornstaedt</A>, <A href="http://www.ps.uni-sb.de/~homik/">Martin Homik</A>, <A href="http://www.ps.uni-sb.de/~tmueller/">Tobias Müller</A>, <A href="http://www.ps.uni-sb.de/~schulte/">Christian Schulte</A> and <A href="http://www.info.ucl.ac.be/~pvr">Peter Van Roy</A><BR><SPAN class="version">Version 1.4.0 (20110908185330)</SPAN></ADDRESS></BODY></HTML>
|