I'm reading  "Concepts, Techniques, and Models of Computer
Programming" and on page 160 I saw the code to draw a tree and I
wanted to run it on my system I've added those two lines to the end of
code given in the book:

MyTree = tree(key:a val:111
              left:tree(key:b val:55
                        left:tree(key:x val:100
                                  left:tree(key:z val:56 left:leaf right:leaf)
                                  right:tree(key:w val:23 left:leaf right:leaf))
                        right:tree(key:y val:105 left:leaf
                                   right:tree(key:r val:77 left:leaf 
right:leaf)))
              right:tree(key:c val:123
                         left:tree(key:d val:119
                                   left:tree(key:g val:44 left:leaf right:leaf)
                                   right:tree(key:h val:50
                                              left:tree(key:i val:5 left:leaf 
right:leaf)
                                              right:tree(key:j val:6 left:leaf 
right:leaf)))
                         right:tree(key:e val:133 left:leaf right:leaf)))

MyTree2 = {AddXY MyTree}

{Browse {DepthFirst MyTree2 3 4 5}}

When I fed the buffer I received the following message:

%***************************** failure **************************
%**
%** Tell: 95 = 5
%**
%** Call Stack:
%** procedure 'DepthFirst' in file "c:/Documents and
Settings/Emre/Desktop/tree.oz", line 20, column 0, PC = 18888300
%**--------------------------------------------------------------


I'm a little bit confused now, I couldn't understand what I should do
to get something similar to the screenshot given in the Figure 3.19 of
the book.

Maybe I'm using the DepthFirst procedure in the wrong way or maybe the
parameters I have passed are wrong, or maybe it is because DepthFirst
is a procedure not a function (but I simply couldn't understand where
its output goes or what the output is, another tree, how it should be
graphically drawn, etc.)

What is the correct way of drawing the actual graphics for the tree?



-- 
Emre Sevinc
_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to