Hi folks,

I'm a newbie, found Mozart on the web and thought it sounded neat. I have a background in functional and OO programming, but am interested in constraints. The only constraint language I've used before now is Metapost. It seemed a bit clunky so I wanted to find out what a real constraint language was like. So I downloaded Mozart (I'm using Windows XP) and have been playing with it.

I checked out the book "Programming With Constraints: An Introduction" by Marriott & Stuckey. In the first chapter they have some practical exercises. They suggest you use CLP(R) or SICStus Prolog. From what I've seen of Prolog it looks clunky too. I wanted to try these exercises in Oz but I can't get them to work. The first one is:

a)  X = 3 ^ Y = 2 - X ^ Z = 3 + X + Y

I wrote that in Oz as:

local X Y Z in
  X = 3
  Y = 2 - X
  Z = 3 + X + Y
  {Browse [X Y Z]}
end

It worked just fine and reported the result [3 ~1 5].

Then I tried the second exercise:

b) Y = 2 - X ^ Z = 3 + X + Y ^ Z = 4

I wrote that in Oz as:

local X Y Z in
  Y = 2 - X
  Z = 3 + X + Y
  Z = 4
  {Browse [X Y Z]}
end

It didn't show an answer. Since it is an unsatisfiable problem, I had hoped to get an exception.

Then I made up my own problem:

local X Y in
  X + Y = 5
  X - Y = 12
  {Browse [X Y]}
end

I think it should give the answer [8.5 ~3.5], but it returned nothing.

What am I doing wrong?

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

Reply via email to