printtree_3( bt(Label,[],[]) ).
printtree_3( bt(Label,Left,Right) ) :-
printtree_3( Left ),
printtree_3( Right ),
printlabel( Label ).
printlabel( X ) :- write( X ), write( ' ' ).
I am attempting to traverse a tree for the first time in prolog and I thought I would do so by printing a tree with someone else's code to see it work in person. The problem is that trying to run this code I always get "False" by the swipl compiler.
For example.
?- printtree_3(a(b,c,d)).
returns false instead of printing the tree. I think that my predicate call is wrong, but I'm not sure. Again I take no credit for the provided code, I just want to run it so I can experiment. If anyone can explain why it's not working I would be very thankful.