Hello,

I'm just starting with Oz/Mozart and trying examples from the
documentation that came with the download of latest version.

When I try the code in 5.3:

% case for pattern matching
proc {Insert Key Value TreeIn ?TreeOut}
   case TreeIn
   of nil then TreeOut = tree(Key Value nil nil)
   [] tree(K1 V1 T1 T2) then
      if Key == K1 then TreeOut = tree(Key Value T1 T2)
      elseif Key < K1 then T in
        TreeOut = tree(K1 V1 T T2)
        {Insert Key Value T1 T}
      else T in
        TreeOut = tree(K1 V1 T1 T)
        {Insert Key Value T2 T}
      end
   end
end
Figure 5.3: Tree insertion using case statement

I mean pasting it into Emacs (OPI running) and run it (with C-M-x) I get:

%********************* binding analysis error *******************
%**
%** variable Insert not introduced
%**
%** in file "Oz", line 76, column 6
%** ------------------ rejected (1 error)


Then I wrap the whole function with

local Insert in
...
end

to make it run. Then I keep on reading the documentation and see an example:

{Browse {Insert alex 17
         {Insert rebecca 20
          {Insert eeva 45 {Insert seif 43 nil}}}}}

And when I try to run it:

%********************* binding analysis error *******************
%**
%** variable Insert not introduced
%**
%** in file "Oz", line 97, column 9
%** ------------------ rejected (1 error)

Then I have to go back, remove that local Insert in ... end wrapping and put

declare Insert

at the beginning of "proc {Insert Key Value TreeIn ?TreeOut} ...".

Now, am I missing something, are the docs a little bit out of synch or
do I have to figure out these kind of quirks myself?

Cheers,
-- 
Emre Sevinc

e-MBA Software Development @ Istanbul Bilgi University
http://www.bilgi.edu.tr
http://www.bilgiemba.net

http://www.cogsci.boun.edu.tr
http://ileriseviye.org/blog
http://fazlamesai.net
_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to