<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
 
 <title>Bluish Coder: mozartoz</title>
 <link href="http://bluishcoder.co.nz/tag/mozartoz/atom.xml" rel="self"/>
 <link href="http://bluishcoder.co.nz/"/>
 <updated>2020-07-10T16:25:05+12:00</updated>
 <id>http://bluishcoder.co.nz/</id>
 <author>
   <name>Bluishcoder</name>
   <email>admin@bluishcoder.co.nz</email>
 </author>

 
 <entry>
   <title>Relational Programming in Mozart/Oz</title>
   <link href="http://bluishcoder.co.nz/2017/03/20/relational-programming-in-mozart-oz.html"/>
   <updated>2017-03-20T23:00:00+13:00</updated>
   <id>http://bluishcoder.co.nz/2017/03/20/relational-programming-in-mozart-oz</id>
   <content type="html">&lt;p&gt;A video I watched recently on logic programming, &lt;a href=&quot;https://vimeo.com/146117469&quot;&gt;A Vision for Relational Programming in miniKanren&lt;/a&gt;, by William Byrd gives some interesting examples of relational programming using &lt;a href=&quot;http://minikanren.org/&quot;&gt;miniKanren&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;miniKanren is an embedded constraint logic programming language designed for writing programs as &lt;em&gt;relations&lt;/em&gt;, rather than as functions or procedures. Unlike a function, a miniKanren relation makes no distinction between its inputs and outputs, leading to a variety of fascinating behaviors. For example, an interpreter written as a relation can also perform code synthesis, symbolic execution, and many other tasks.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;The video demonstrates how a relational interpreter can be used not just to evaluate expressions but to also generate valid expressions given a result. Other examples of relational programming would be the Prolog examples in my &lt;a href=&quot;https://bluishcoder.co.nz/2016/08/30/kicking-the-tires-of-shen-prolog.html&quot;&gt;Shen Prolog post&lt;/a&gt; where relational functions like &lt;code&gt;member&lt;/code&gt; can be used to enumerate all members of a list, as well as the traditional finding a member in a list.&lt;/p&gt;

&lt;p&gt;I like to use the &lt;a href=&quot;https://mozart.github.io/&quot;&gt;Mozart Programming System&lt;/a&gt; for exploring logic programming and this post goes through converting some examples in Mozart/Oz. Mozart is an implementation of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Oz_(programming_language)&quot;&gt;Oz programming language&lt;/a&gt;. The book &quot;&lt;a href=&quot;https://www.info.ucl.ac.be/~pvr/book.html&quot;&gt;Concepts, Techniques, and Models of Computer Programming&lt;/a&gt;&quot; is a good textbook for learning the different programming models that Mozart enables, including the relational model. For the examples here I&#39;m using &lt;a href=&quot;https://github.com/mozart/mozart/tree/mozart-1-3-x&quot;&gt;Mozart 1.3.x&lt;/a&gt;. It&#39;s an old language and implementation but I like to experiment with languages that are a bit different to mainstream languages.&lt;/p&gt;

&lt;p&gt;The Prolog examples following can be tested in the online SWI Prolog implementation, &lt;a href=&quot;http://swish.swi-prolog.org/&quot;&gt;Swish&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Basic example&lt;/h2&gt;

&lt;p&gt;The following function in Prolog has multiple values that be used as an argument:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;foo(one).
foo(two).
foo(three).
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Passing either &lt;code&gt;one&lt;/code&gt;, &lt;code&gt;two&lt;/code&gt; or &lt;code&gt;three&lt;/code&gt; succeeds:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;foo(one).
true

foo(two).
true

foo(four).
false
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Using backtracking it&#39;s possible to enumerate all valid arguments:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;foo(X).
X = one
X = two
X = three
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The function &lt;code&gt;findall&lt;/code&gt; can be used to return all values in a list:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;findall(X, foo(X), Y).
Y = [one, two, three]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Backtracking in Mozart/Oz is not the default. Mozart provides the &lt;code&gt;choice&lt;/code&gt; statement to enable backtracking. A &lt;code&gt;choice&lt;/code&gt; statement contains a sequence of clauses separated by &lt;code&gt;[]&lt;/code&gt; where a &#39;choice point&#39; is created for each group of clauses. Each clause is tried in turn - if a particular clause fails then execution backtracks to a previous choice point and is resumed until one succeeds or all fails. The equivalent implementation of &lt;code&gt;foo&lt;/code&gt; in Mozart is:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;fun {Foo}
   choice
      one
   []
      two
   []
      three
   end
end
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Prolog uses an automatic depth first search to find solutions. Mozart doesn&#39;t do automatic search - programs involving choice points must be run in a search engine that can implement any form of search required. A default search engine is provided that does depth first search. Here we create a search object and enumerate all the valid results manually:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Y = {New Search.object script(Foo)}
{Browse {Y next($)}
[one]

{Browse {Y next($)}
[two]

{Browse {Y next($)}
[three]

{Browse {Y next($)}
nil
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The Mozart syntax can look a little strange at first but it&#39;s not too difficult to understand once it&#39;s learnt. &lt;code&gt;New&lt;/code&gt; instantiates an object. &lt;a href=&quot;https://mozart.github.io/mozart-v1/doc-1.4.0/system/node12.html#sec.search.object&quot;&gt;Search.object&lt;/a&gt; is the class of the object being created. &lt;code&gt;script(Foo)&lt;/code&gt; is a record that is being passed to the constructor of &lt;code&gt;Search.object&lt;/code&gt;. The &lt;code&gt;Foo&lt;/code&gt; is the function we created previously. The remaining statements call the &lt;code&gt;next&lt;/code&gt; method on the object. &lt;code&gt;next&lt;/code&gt; takes as an argument a variable that receives the result of the call. The use of &lt;code&gt;$&lt;/code&gt; tells Mozart to pass a temporary variable to receive the result, and return that result as the result of the call. This result is passed to &lt;code&gt;Browse&lt;/code&gt; which displays the result in the GUI browser. Results are returned in single element lists and when there are no more results, &lt;code&gt;nil&lt;/code&gt; is returned.&lt;/p&gt;

&lt;p&gt;There is a library function to return all possible solutions in a list, &lt;a href=&quot;https://mozart.github.io/mozart-v1/doc-1.4.0/system/node11.html#label69&quot;&gt;Search.all&lt;/a&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{Browse {Search.all Foo 1 _ $}}
[one two three]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The ability to interactively drive the search enables writing programs that control the search process. The &lt;a href=&quot;https://mozart.github.io/mozart-v1/doc-1.4.0/explorer/node3.html#chapter.interface&quot;&gt;Explorer&lt;/a&gt; is a Mozart tool that uses this ability to show an interactive graph of the search space of a program. It can be run to show a graph of all solutions in &lt;code&gt;Foo&lt;/code&gt; with:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{Explorer.all Foo}
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Membership testing&lt;/h2&gt;

&lt;p&gt;In Prolog a function to test membership of a list can be written as:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;mem(X, [X|_]).
mem(X, [_|Y]) :- mem(X, Y).
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This states that &lt;code&gt;X&lt;/code&gt; is a member of the list if &lt;code&gt;X&lt;/code&gt; is the head of the list (the first element), or if it is a member of the tail of the list.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;mem(2, [1,2,3]).
true.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Thanks to Prolog&#39;s backtracking you can also use this function to enumerate all values in the list:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;mem(X, [1,2,3]).
1
2
3
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In Swish you need to click &#39;Next&#39; to get each result. You can return all results as a list with &lt;code&gt;findall&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;findall(X, mem(X, [1,2,3]), Y).
Y = [1, 2, 3].
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This is what the non-backtrackable member function looks like in Mozart:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;fun {Mem X Ys}
   case Ys
   of nil then false
   [] Y|Yr then X==Y orelse {Mem X Yr}
   end
end

{Browse {Mem 1 [1 2 3]}}
true
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;A backtrackable version of this code uses &lt;code&gt;choice&lt;/code&gt; instead of &lt;code&gt;case&lt;/code&gt; to create choice points in each clause:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;proc {Mem X Ys}
   choice
      Ys = X|_
   []
      Yr
   in
      Ys = _|Yr
      {Mem X Yr}
   end
end
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Here &lt;code&gt;proc&lt;/code&gt; is used instead of &lt;code&gt;fun&lt;/code&gt;. A procedure doesn&#39;t return a value. It is expected to bind values to arguments to return a result. In this case either &lt;code&gt;X&lt;/code&gt; or &lt;code&gt;Ys&lt;/code&gt; will be bound depending on what is passed as an argument. Given the call &lt;code&gt;Mem 1 [1 2 3]&lt;/code&gt; then the first clause of &lt;code&gt;choice&lt;/code&gt; succeeds - the head of the list is equal to &lt;code&gt;X&lt;/code&gt;. With the call &lt;code&gt;Mem X [1 2 3]&lt;/code&gt; then &lt;code&gt;X&lt;/code&gt; will be successively bound to each element of the list depending on what order the search engine used to evaluate it uses. &lt;code&gt;Mem 1 Y&lt;/code&gt; will enumerate all possible lists containing &lt;code&gt;1&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{Browse {Search.all proc {$ L} {Mem 1 [1 2 3]} end 1 _ $}}
[_]

{Browse {Search.all proc {$ L} {Mem L [1 2 3]} end 1 _ $}}
[1 2 3]

Y={New Search.object script(proc {$ L} {Mem 1 L} end)}
{Browse {Y next($)}}
[1|_]

{Browse {Y next($)}}
[_|1|_]

{Browse {Y next($)}}
[_|_|1|_]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The difference here compared to our search over &lt;code&gt;Foo&lt;/code&gt; is that an anonymous procedure is passed to the search engine. &lt;code&gt;Foo&lt;/code&gt; was aleady a single argument procedure so it didn&#39;t require a wrapper. The anonymous procedure takes a single argument which is expected to be bound to the result of a single iteration. In the first example no result is bound, just the fact that the &lt;code&gt;Mem&lt;/code&gt; call succeeds is enough. In the second, &lt;code&gt;L&lt;/code&gt; is bound to the first argument to &lt;code&gt;Mem&lt;/code&gt; resulting in a list of all valid first arguments. In the third, &lt;code&gt;L&lt;/code&gt; is bound to the second argument to &lt;code&gt;Mem&lt;/code&gt; resulting in a list of all valid lists that contain the element &lt;code&gt;1&lt;/code&gt;. This is infinite so we only iterate the first few solutions.&lt;/p&gt;

&lt;h2&gt;Syntax checker&lt;/h2&gt;

&lt;p&gt;The miniKanren video referenced earlier, &lt;a href=&quot;https://vimeo.com/146117469&quot;&gt;A Vision for Relational Programming in miniKanren&lt;/a&gt;, has an example of a simple language syntax checker implemented in the relational style. The equivalent Mozart implementation is:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;proc {LCSyn Term}
   choice
      {IsAtom Term true}
   []
      X T
   in
      Term = lambda(X T)
      {IsAtom X true}
      {LCSyn T}
   []
      E1 E2
   in
      Term = [E1 E2]
      {LCSyn E1}
      {LCSyn E2}
   end
end
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;A &lt;code&gt;Term&lt;/code&gt; is either an atom, a &lt;code&gt;lambda&lt;/code&gt; record containing an argument and body, or application of two expressions (here represented as a list). A &lt;code&gt;Term&lt;/code&gt; can be tested to see if it is valid with:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{Browse {Search.one.depth
         proc {$ L}
            {LCSyn lambda(foo bar)}
         end
         1 _ $}}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;A result of &lt;code&gt;[_]&lt;/code&gt; indicates that it succeded (&lt;code&gt;nil&lt;/code&gt; would be a failure). Thanks to the magic of relational programming it&#39;s possible to enumerate all valid terms:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Y={New Search.object script(LCSyn)}
{Browse {Y next($)}}
[lambda(_ _)]

{Browse {Y next($)}}
[[_ _]]

{Browse {Y next($)}}
[[lambda(_ _) _]]

{Browse {Y next($)}}
[[[_ _] _]]
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Reversible Factorial&lt;/h2&gt;

&lt;p&gt;As a final example, the following program implements a factorial function that can compute the factorial of a number, or the number given its factorial:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;proc {Fact ?N ?F}
   proc {Fact1 ?N ?F}
      choice
         N = 0
         F = 1
      []
         N1 F1
      in
         N1::0#FD.sup
         F1::0#FD.sup
         N &amp;gt;: 0
         N1 =: N - 1
         F =: N * F1
         {Fact1 N1 F1}
      end
   end
in
   N::0#FD.sup
   F::0#FD.sup      
   {Fact1 N F}
   {FD.distribute naive [N F]}
end

% Factorial of 5
{Browse {Search.all proc {$ L} {Fact 5 L} end 1 _ $}}
[120]

% What factorial gives the answer 24
{Browse {Search.all proc {$ L} {Fact L 24} end 1 _ $}}
[4]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This uses a few more Mozart features but is essentially a search through the choice points in a &lt;code&gt;choice&lt;/code&gt; statement. In this case it also uses &lt;a href=&quot;https://mozart.github.io/mozart-v1/doc-1.4.0/fdt/index.html&quot;&gt;Finate Domain Constraints&lt;/a&gt;. This allows telling Mozart what the range of a particular integer value can be, provides constraints upon that value and the search process will attempt to find a solution that results in the integer containing a single value. The syntax &lt;code&gt;X::0#5&lt;/code&gt; constrains the variable &lt;code&gt;X&lt;/code&gt; to be from zero to five. &lt;code&gt;FD.sup&lt;/code&gt; is a constant for an implementation defined maximum upper bound. Operators ending in &lt;code&gt;:&lt;/code&gt; impose constraints on values that can be backtracked during search. There&#39;s a limitation to this approach in that the finite domain constraint has an implementation defined maximum upper value and the search will fail if it hits this value which unfortunately limits the practicality of a reverse factorial.&lt;/p&gt;

&lt;h2&gt;Mozart/Oz summary&lt;/h2&gt;

&lt;p&gt;Mozart/Oz has a lot of other interesting functionality. &lt;a href=&quot;https://mozart.github.io/mozart-v1/doc-1.4.0/dstutorial/index.html&quot;&gt;Distributed objects&lt;/a&gt;, &lt;a href=&quot;https://mozart.github.io/mozart-v1/doc-1.4.0/wp/index.html&quot;&gt;GUI programming&lt;/a&gt;, &lt;a href=&quot;https://mozart.github.io/mozart-v1/doc-1.4.0/tutorial/node8.html#chapter.concurrency&quot;&gt;Concurrency&lt;/a&gt;, amongst others. It&#39;s a fun tool to experiment with and &lt;a href=&quot;https://www.info.ucl.ac.be/~pvr/book.html&quot;&gt;Concepts, Techniques, and Models of Computer Programming&lt;/a&gt; is an excellent read.&lt;/p&gt;

&lt;p&gt;Unfortunately development of Mozart has slowed from its heyday. A reimplementation of Mozart, called &lt;a href=&quot;https://github.com/mozart/mozart2&quot;&gt;Mozart 2&lt;/a&gt; is being worked on that uses LLVM for the code generator and replaces the internal constraint programming system with the &lt;a href=&quot;http://www.gecode.org/&quot;&gt;Gecode&lt;/a&gt; toolkit. Development seems to have stalled recently and it lacks many of the features that already exist in older Mozart versions. Hopefully it&#39;ll pick up steam again.&lt;/p&gt;

&lt;p&gt;For this reason I continue to use &lt;a href=&quot;https://github.com/mozart/mozart/tree/mozart-1-3-x&quot;&gt;Mozart 1.3.x&lt;/a&gt;. There is a &lt;a href=&quot;https://github.com/mozart/mozart&quot;&gt;1.4.x version&lt;/a&gt; but it has some issues that make me avoid using it. The distributed layer was replaced with an implementation written in C++ which &lt;a href=&quot;https://github.com/mozart/mozart/issues/164&quot;&gt;has some bugs&lt;/a&gt; that I&#39;ve been unable to work around in projects where I used it. The &lt;a href=&quot;https://mozart.github.io/mozart-v1/doc-1.4.0/dpanel/index.html&quot;&gt;distribution panel&lt;/a&gt; is broken due to the hooks it requires not being implemented by the new C++ layer. At some point Mozart 2 may be complete enough for me to move to that version. I make the occasional fixes to 1.3.x and 1.4.x to keep it building and running on Linux.&lt;/p&gt;

&lt;p&gt;Even though Mozart seems to be in a holding pattern it&#39;s a great for exploring ideas and &lt;a href=&quot;https://mozart.github.io/publications/&quot;&gt;the list of papers&lt;/a&gt; is a good resource for learning about distributed programming, constraints and concurrency. Some interesting projects implemented in Mozart include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://beernet.info.ucl.ac.be/&quot;&gt;Beernet&lt;/a&gt;, a P2P network (&lt;a href=&quot;https://github.com/bmejias/beernet/&quot;&gt;source&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.info.ucl.ac.be/%7Epvr/Grolaux-PhD2007-Final.pdf&quot;&gt;Ebl/Tk&lt;/a&gt; (PDF), a GUI library where widgets can be migrated across devices (&lt;a href=&quot;https://github.com/sjmackenzie/ebl&quot;&gt;source&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/wmeyer/roads/wiki&quot;&gt;Roads&lt;/a&gt;, a web application framework (&lt;a href=&quot;https://github.com/wmeyer/roads/&quot;&gt;source&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://web.archive.org/web/20041211191530/http://www.info.ucl.ac.be/people/ned/transdraw/transdraw.html&quot;&gt;Transdraw&lt;/a&gt;, a distributed collaborative graphical editor (&lt;a href=&quot;https://github.com/sjmackenzie/transdraw&quot;&gt;source&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://strasheela.sourceforge.net/strasheela/doc/index.html&quot;&gt;Strasheela&lt;/a&gt;, a constraint based music system which also has a &lt;a href=&quot;http://strasheela.sourceforge.net/strasheela/doc/StrasheelaTutorial.html&quot;&gt;good Oz tutorial&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

</content>
 </entry>
 
 <entry>
   <title>Building Mozart/Oz on Windows</title>
   <link href="http://bluishcoder.co.nz/2011/05/11/building-mozart-oz-on-windows.html"/>
   <updated>2011-05-11T20:00:00+12:00</updated>
   <id>http://bluishcoder.co.nz/2011/05/11/building-mozart-oz-on-windows</id>
   <content type="html">&lt;p&gt;The &lt;a href=&quot;http://www.mozart-oz.org/&quot;&gt;Mozart Programming System&lt;/a&gt; is an implementation of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Oz_%28programming_language&quot;&gt;Oz programming language&lt;/a&gt;. It&#39;s the language used in the book &lt;a href=&quot;http://www.info.ucl.ac.be/~pvr/book.html&quot;&gt;Concepts, Techniques, and Models of Computer Programming&lt;/a&gt; by Peter Van Roy and Seif Haridi. From the Mozart website:&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;Mozart is based on the Oz language, which supports declarative programming, object-oriented programming, constraint programming, and concurrency as part of a coherent whole. For distribution, Mozart provides a true network transparent implementation with support for network awareness, openness, and fault tolerance. Mozart supports multi-core programming with its network transparent distribution and is an ideal platform for both general-purpose distributed applications as well as for hard problems requiring sophisticated optimization and inferencing abilities.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;The last release of Mozart was a couple of years ago and the &lt;a href=&quot;http://www.mozart-oz.org/documentation/install/node6.html#chapter.src.cygwin&quot;&gt;steps to build on Windows&lt;/a&gt; no longer seem to work. It required &lt;a href=&quot;http://cygwin.com&quot;&gt;Cygwin&lt;/a&gt; to build but used the &lt;a href=&quot;http://www.mingw.org&quot;&gt;MingW&lt;/a&gt; compiler to get a native Windows build.&lt;/p&gt;

&lt;p&gt;Mozart/Oz has recently seen a bit of a life with activity in the &lt;a href=&quot;http://www.mozart-oz.org/lists/&quot;&gt;mailing lists&lt;/a&gt; and a move to &lt;a href=&quot;https://github.com/mozart&quot;&gt;github for source control and issue tracking&lt;/a&gt;. I was working on a project that needed Windows and Linux support so thought I&#39;d have a try at &lt;a href=&quot;http://lists.gforge.info.ucl.ac.be/pipermail/mozart-hackers/2011/003192.html&quot;&gt;converting Mozart to compile using MingW on Windows&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I&#39;ve got a basic build working and have patches that I hope will eventually be merged. In the meantime I thought I&#39;d post about how to build using MingW with my patches. The following steps will build Mozart, the standard library, Emacs (used as the IDE) and Tcl/Tk (for GUI).&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Download and install &lt;a href=&quot;http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/mingw-get-inst/&quot;&gt;mingw-get-inst&lt;/a&gt;. Install the &#39;MSYS Basic System&#39; and the &#39;C++ Compiler&#39;.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;From the &#39;MingW Shell&#39;, run the following commands to install the required support packages:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt; $ mingw-get install mingw32-libgmp
 $ mingw-get install mingw32-gmp
 $ mingw-get install mingw32-libz
 $ mingw-get install msys-libgdbm
 $ mingw-get install msys-libregex
 $ mingw-get install mingw32-autoconf2.1
 $ mingw-get install mingw32-autoconf
 $ mingw-get install msys-flex
 $ mingw-get install msys-bison
 $ mingw-get install mingw32-gcc-g++
 $ mingw-get install msys-wget
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Download and install the &lt;a href=&quot;http://code.google.com/p/msysgit/&quot;&gt;msysgit&lt;/a&gt; package. I installed it in &lt;code&gt;C:/git&lt;/code&gt;. It&#39;s best to install it in a directory that doesn&#39;t have spaces in the name.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Make a directory to store the resulting &#39;Mozart/Oz&#39; binaries. I used &lt;code&gt;/p&lt;/code&gt; to keep my command lines short but you could also use &lt;code&gt;/mingw&lt;/code&gt; to install alongside the existing MingW programs:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt; $ mkdir /p
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Download and build Tcl/Tk 8.5 from source, configured to install in the directory above:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt; $ wget http://prdownloads.sourceforge.net/tcl/tcl8.5.9-src.tar.gz
 $ wget http://prdownloads.sourceforge.net/tcl/tk8.5.9-src.tar.gz
 $ tar xvf tcl8.5.9-src.tar.gz
 $ tar xvf tk8.5.9-src.tar.gz
 $ cd tcl8.5.9
 tcl8.5.9 $ ./win/configure --prefix=/p
 tcl8.5.9 $ make &amp;amp;&amp;amp; make install
 tcl8.5.9 $ cd ../tk8.5.9
 tk8.5.9 $ ./win/configure --prefix=/p --with-tcl=`pwd`/../tcl8.5.9
 tk8.5.8 $ make &amp;amp;&amp;amp; make install
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Download and build emacs from source:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt; $ wget http://ftp.gnu.org/gnu/emacs/emacs-23.3.tar.gz
 $ tar xvf emacs-23.3.tar.gz
 $ cd emacs-23.3
 emacs-23.3 $ cd nt
 emacs-23.3/nt $ cmd /c &quot;configure --prefix=/p --without-xpm \
                  --without-png --without-jpeg --without-tiff --without-gif&quot;
 emacs-23.3/nt $ make &amp;amp;&amp;amp; make install
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Build my &lt;code&gt;win32_build&lt;/code&gt; branch of Mozart. Note that I add the directory where I installed Git into the path. I also add the &#39;bin&#39; directory of where I set Mozart to be installed.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt; $ export PATH=$PATH:/c/git/bin:/p/bin
 $ git clone git://github.com/doublec/mozart.git
 $ cd mozart
 mozart $ git checkout -b win32_build origin/win32_build
 mozart $ cd ..
 $ mkdir build
 $ cd build
 build $ windlldir=/p ../mozart/configure --prefix=/p \
          --with-inc-dir=/p/include --with-lib-dir=/p/lib \
          --with-tcl=/p --with-tk=/p --disable-contrib-compat \
          --disable-contrib --enable-modules-static \
          --disable-doc --disable-chm
 build $ make &amp;amp;&amp;amp; make install
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Build my &lt;code&gt;win32_build&lt;/code&gt; branch of the Mozart standard library:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt; $ git clone git://github.com/doublec/mozart-stdlib.git
 $ cd mozart-stdlib
 mozart-stdlib $ git checkout -b win32_build origin/win32_build
 mozart-stdlib $ cd ..
 $ mkdir build-stdlib
 $ cd build-stdlib
 build-stdlib $ ../mozart-stdlib/configure --prefix=/p
 build-stdlib $ make &amp;amp;&amp;amp; make install
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can now test Mozart by running the comand &lt;code&gt;oz&lt;/code&gt;. This should start &lt;code&gt;emacs&lt;/code&gt; with a Mozart/Oz system running. You can evaluate an example by entering &lt;code&gt;{Browse 1+1}&lt;/code&gt; into the topmost &lt;code&gt;emacs&lt;/code&gt; pane and evaluating with &lt;code&gt;Ctrl+. Ctrl+l&lt;/code&gt;. You&#39;ll need to set the OZEMACS environment variable to point to the location of &lt;code&gt;emacs&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt; $ export OZEMACS=/p/bin/emacs.exe
 $ oz
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;That&#39;s a large number of steps but it gives a complete Mozart/Oz environment. From there you can &lt;a href=&quot;http://www.mozart-oz.org/documentation/tutorial/index.html&quot;&gt;work through the tutorial&lt;/a&gt;. There&#39;s work to be done to make it easier and get more testing. One contributor is looking at creating a Visual Studio project to do the builds as well as to improve on the basic MingW support I&#39;ve got working, so there&#39;s hope for less steps in the future.&lt;/p&gt;

&lt;p&gt;The Mozart/Oz system is interesting and there&#39;s some neat projects written in it. A short list of some of them:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://beernet.info.ucl.ac.be/&quot;&gt;BeerNet&lt;/a&gt;, a P2P network.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/sjmackenzie/transdraw&quot;&gt;TransDraw&lt;/a&gt;, a distributed shared drawing program. I run a live transdraw instance which you can connect too. &lt;a href=&quot;http://mozart.info.ucl.ac.be/mailman/mozart-hackers/2011/003265.html&quot;&gt;Instructions here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/wmeyer/roads/wiki/&quot;&gt;Roads&lt;/a&gt;, a web application framework.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://gforge.info.ucl.ac.be/projects/ebl/&quot;&gt;EBL/Tk&lt;/a&gt;, an UI library that can do migration of user interface elements across the network.&lt;/li&gt;
&lt;/ul&gt;

</content>
 </entry>
 
 
</feed>
