I have a function, that creates a new tree, based on an old one, and the min/max values of each node from the old one. using the datatypes:
datatype 'a Tree = LEAF of 'a | NODE of ('a Tree) * ('a Tree)
and
datatype 'a myTree = myLEAF of 'a | myNODE of 'a*'a*('a myTree)*('a myTree)
for instance,
(NODE(NODE(NODE(LEAF(0),LEAF(9)),LEAF(6)),NODE(LEAF(3),LEAF(10))))
should produce:
(myNODE(0,10,myNODE(0,9,myNODE(0,9,myLEAF(0),myLEAF(9)),myLEAF(6)),myNODE(3,10,myLEAF(3),myLEAF(10))))
Everything seems to work. Except, the values in the leaf and internal nodes are replaced with '#'.
example:
minmaxTree t1;
val it =
myNODE (1,2,myNODE (1,2,myNODE #,myLEAF #),myNODE (1,2,myNODE #,myNODE #))
: int myTree
Im confused why the sml compiler is replacing with '#', where the values are clearly ints. Thank you kindly!
As pointed out by molbdnilo, this was a duplicate question, the answer to my question is found here: here There was an output restriction, the compiler was not set to print out in depth, as i need it to. after applying the solution here,
my output is:
- minmaxTree t1;
val it =
myNODE
(1,2,myNODE (1,2,myNODE (1,2,myLEAF 1,myLEAF 2),myLEAF 1),
myNODE
(1,2,myNODE (1,2,myLEAF 1,myLEAF 2),
myNODE (1,2,myNODE (1,2,myLEAF 1,myLEAF 2),myLEAF 1))) : int myTree