Russ Abbott wrote:
I'm now working on Chapter 9 of CTM. It seems to be inconsistent with
the material in Section 12 of the Tutorial
(http://www.mozart-oz.org/documentation/tutorial/node12.html#chapter.lp
<http://www.mozart-oz.org/documentation/tutorial/node12.html#chapter.lp>).
They're not inconsistent, but both the approaches and the goals are
different. CTM is about concepts and techniques in general, while the
tutorial is specific to Mozart. CTM is not a documentation of Mozart!
Among other things the tutorial discusses or, dis, etc, (but not choice)
whereas CTM discusses only choice.
The constructs "or", "dis", etc. are abstractions. The real primitive
operation is "choice". For the book it was chosen to focus on the
primitive operation instead of discussing Mozart-specific abstractions.
local
fun {Digit}
choice 0 [] 1 [] 2 [] 3 [] 4 [] 5 [] 6 [] 7 [] 8 [] 9 end
end
in
{Browse {Search {Digit}}}
end
CTM uses Solve and SolveAll, but I got compiler error messages when I
tried either of those. In the above, I used Search instead. No
compiler errors, but no output. So I suppose choice is defined, but I
don't understand why I got no output. I also got no output when I just
tried just {Browse {Digit}}. (I don't understand why not.)
Neither Solve nor SolveAll are defined in Mozart, but IIRC their code is
given in the book (must be chapter 12). You should simply use Space.new
instead of NewSpace, etc. Check out module Space for space operations.
Search is a module that implements search engines. Use SearchOne or
SearchAll.
Note that {Browse {Digit}} cannot work, since search is not a global
thing in Mozart (contrary to Prolog). You have to explicitly use a
search engine like SearchOne or SearchAll.
Cheers,
raph
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users